Primality by trial division: Difference between revisions

Content added Content deleted
Line 3,043: Line 3,043:


<syntaxhighlight lang="langur">val .isPrime = fn(.i) .i == 2 or .i > 2 and
<syntaxhighlight lang="langur">val .isPrime = fn(.i) .i == 2 or .i > 2 and
not any f(.x) .i div .x, pseries 2 .. .i ^/ 2
not any fn(.x) .i div .x, pseries 2 .. .i ^/ 2


writeln filter .isPrime, series 100</syntaxhighlight>
writeln filter .isPrime, series 100</syntaxhighlight>