This routine is used in more than one place, and is essentially a
template that can by used for many different types, eg INT, LONG INT...
MODE ISPRIMEINT = INT, LONG INT, etc
PR READ "prelude/is_prime.a68" PR
PROC is prime = ( ISPRIMEINT p )BOOL:
IF p <= 1 OR ( NOT ODD p AND p/= 2) THEN
BOOL prime := TRUE;
FOR i FROM 3 BY 2 TO ENTIER sqrt(p)
WHILE prime := p MOD i /= 0 DO SKIP OD;
This is a template. There are many others. See Category:RCTemplates for a complete list of templates.