Category talk:Wren-long: Difference between revisions
Content added Content deleted
(→Source code: Removed the previous limitation on the ULong.isPrime method.) |
m (→Source code: Minor bug fix.) |
||
Line 458: | Line 458: | ||
// Returns the next prime number greater than the current instance. |
// Returns the next prime number greater than the current instance. |
||
nextPrime { |
nextPrime { |
||
if (this < ULong.two) return ULong.two |
|||
var n = isEven ? this + ULong.one : this + ULong.two |
|||
while (true) { |
while (true) { |
||
if (n.isPrime) return n |
if (n.isPrime) return n |