Category talk:Wren-long: Difference between revisions

→‎Source code: Added ULong.nextPrime method.
(→‎Source code: Added multinomial and binomial methods to ULong class.)
(→‎Source code: Added ULong.nextPrime method.)
Line 397:
if (this > ULong.largest/2) Fiber.abort("Cannot test %(this) for primality.")
return ULong.millerRabinTest_(this, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37])
}
 
// Returns the next prime number greater than the current instance.
nextPrime {
var n = isEven ? this + ULong.One : this + ULong.two
while (true) {
if (n.isPrime) return n
n = n + ULong.two
}
}
 
9,485

edits