Primality by trial division: Difference between revisions
Content deleted Content added
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 1,688:
{{trans|Perl 6}}
Following 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,
writeln where .isPrime, series 1..100</lang>
|