Category talk:Wren-math: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
→‎Source code: Replaced primeSieve method with a more efficient one (2 to 3 times faster). Also added primeCount method.
PureFox (talk | contribs)
→‎Source code: primeSieve and primeCount should be static methods.
Line 162:
// If primesOnly is false returns a bool list 'c' of size (n + 1) where:
// c[i] is false if 'i' is prime or true if 'i' is composite.
static primeSieve(n, primesOnly) {
if (n < 2) return []
var primes = [2]
Line 193:
 
// Sieves for primes up to and including 'n' and returns how many there are.
static primeCount(n) {
if (n < 2) return 0
var count = 1
Return to "Wren-math" page.