Category talk:Wren-math: Difference between revisions
Content added Content deleted
(→Source code: Int.isPrime now uses a larger wheel - about 25% quicker than before.) |
m (→Source code: Minor bug fix.) |
||
Line 413: | Line 413: | ||
// Returns the next prime number greater than 'n'. |
// Returns the next prime number greater than 'n'. |
||
static nextPrime(n) { |
static nextPrime(n) { |
||
if (n < 2) return 2 |
|||
n = (n%2 == 0) ? n + 1 : n + 2 |
n = (n%2 == 0) ? n + 1 : n + 2 |
||
while (true) { |
while (true) { |