Numbers whose binary and ternary digit sums are prime: Difference between revisions

Content added Content deleted
(Added 11l)
(→‎{{header|11l}}: optimize `is_prime` function)
Line 8: Line 8:
{{trans|Nim}}
{{trans|Nim}}


<lang 11l>F is_prime(n)
<lang 11l>F is_prime(a)
I n < 2
I a == 2
R 1B
I a < 2 | a % 2 == 0
R 0B
R 0B
L(i) (3 .< Int(sqrt(a)) + 1).step(2)

L(i) 2 .. Int(sqrt(n))
I a % i == 0
I n % i == 0
R 0B
R 0B

R 1B
R 1B