Category talk:Wren-math: Difference between revisions
→Source code: Replaced Int.primeCount method with a non-memoized version.
(→Source code: Added a second 'divisors' method which is quicker for large numbers with a small number of prime factors.) |
(→Source code: Replaced Int.primeCount method with a non-memoized version.) |
||
Line 311:
// Private helper method which counts and returns how many primes there are
// up to and including 'n' using the Legendre method.
static legendre_(n,
if (
var
return legendre_(n, a-1, primes)
}
▲ // Computes, using an appropriate method, and returns how many primes there are
// up to and including 'n'.
static primeCount(n) {
if (n <
var limit = n.sqrt.floor
var primes = primeSieve(limit)
var
return legendre_(n,
}
|