Primality by trial division: Difference between revisions

Content added Content deleted
(Fixed up task description)
Line 1: Line 1:
{{task}}Write a boolean function that tells whether a given integer is prime. Remember that 1 and all non-positive numbers are not prime.
{{task}}Write a boolean function that tells whether a given integer is prime. Remember that 1 and all non-positive numbers are not prime.


Use trial division. Even numbers may be eliminated right away. A loop from 3 to √(n) will suffice, but other loops are allowed.
Implement the simplest primality test, using trial division.


=={{header|Ada}}==
=={{header|Ada}}==