Category talk:Wren-math: Difference between revisions

Content added Content deleted
(→‎Source code: Replaced Int.primeCount with a much quicker version.)
m (→‎Source code: Minor change.)
Line 332: Line 332:
// See https://rosettacode.org/wiki/Legendre_prime_counting_function for details.
// See https://rosettacode.org/wiki/Legendre_prime_counting_function for details.
static primeCount(n) {
static primeCount(n) {
if (n < 3) return (n < 2) ? 0 : 1
if (n < 2) return 0
if (n < 9) return ((n + 1)/2).floor
if (n < 9) return ((n + 1)/2).floor
var masks = [1, 2, 4, 8, 16, 32, 64, 128]
var masks = [1, 2, 4, 8, 16, 32, 64, 128]