Primality by trial division: Difference between revisions

m
→‎unrolled version: changed a couple of comments. -- ~~~~
m (→‎{{header|REXX}}: changed some comments. -- ~~~~)
m (→‎unrolled version: changed a couple of comments. -- ~~~~)
Line 1,427:
if x<11 then return wordpos(x,'2 3 5 7')\==0 /*is it a wee prime? */
if x//2==0 then return 0 /*eliminate the evens. */
if x//3==0 then return 0 /* ...··· and eliminate the triples.*/
/*Note: right dig test: faster than // is modulus. */
do k=5 by 6 until k*k > x /*this skips odd multiples of three3. */
if x // k == 0 then return 0 /*perform a divide (modulus), */
if x // (k+2) == 0 then return 0 /* ...··· and the next umpty one. */
end /*k*/
/*Note: // is modulus. */
 
return 1 /*did all divisions, it's prime. *//</lang>
'''output''' is identical to the first version.
<br><br>