Primality by trial division: Difference between revisions

Content added Content deleted
(Add ABC)
Line 368: Line 368:
endmethod.
endmethod.
ENDCLASS.</syntaxhighlight>
ENDCLASS.</syntaxhighlight>

=={{header|ABC}}==
<syntaxhighlight lang="ABC">HOW TO REPORT prime n:
REPORT n>=2 AND NO d IN {2..floor root n} HAS n mod d = 0

FOR n IN {1..100}:
IF prime n: WRITE n</syntaxhighlight>
{{out}}
<pre>2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97</pre>


=={{header|ACL2}}==
=={{header|ACL2}}==