Rhonda numbers: Difference between revisions
Replaced "isOdd" with "isEven".
(Created Nim solution.) |
(Replaced "isOdd" with "isEven".) |
||
Line 1,599:
type Base = 2..36
template
func isPrime(n: Natural): bool =
## Return true if "n" is prime.
if n < 2: return false
if n.
if n mod 3 == 0: return n == 3
var d = 5
Line 1,623:
## Return the sum of prime factors of "n".
var n = n.Natural
while n.
inc result, 2
n = n shr 1
|