2 lines
103 B
Text
2 lines
103 B
Text
fcn totient(n){ [1..n].reduce('wrap(p,k){ p + (n.gcd(k)==1) }) }
|
|
fcn isPrime(n){ totient(n)==(n - 1) }
|