Sieve of Eratosthenes: Difference between revisions
Content deleted Content added
Sieve of Eratosthenes in various BASIC dialents (BASIC256, QBasic and True BASIC) |
m →{{header|R}}: return correct type when n<2 (it's an integer vector, not a NULL list) |
||
Line 15,182:
=={{header|R}}==
<lang
if (n < 2)
else {
primes <- rep(
primes[[1]] <-
for(i in seq(
primes[seq(i * i, n,
}
}
}
▲ return(which(primes))
}
Line 15,211 ⟶ 15,212:
'''Alternate Odds-Only Version'''
<lang
if (n < 2) return(
lmt <- (sqrt(n) - 1) / 2
sz <- (n - 1) / 2
|