Primality by trial division: Difference between revisions

m
(added Ol)
Line 1,728:
=== Functional ===
{{trans|Perl 6}}
Followingfollowing the Perl 6 example, which states, "Integer $i is prime if it is greater than one and is divisible by none of 2, 3, up to the square root of $i" (plus an adjustment for the prime number 2).
<lang langur>val .isPrime = f .i == 2 or .i > 2 and not any f(.x) .i rem .x == 0, pseries 2 to .i ^/ 2
 
890

edits