Primality by trial division: Difference between revisions

→‎{{header|XPL0}}: Fix bug. Intrinsic 'code' declarations are now automatic.
m (switched from a word ("two") --> '''2''' (for consistency).)
(→‎{{header|XPL0}}: Fix bug. Intrinsic 'code' declarations are now automatic.)
Line 4,117:
 
=={{header|XPL0}}==
<lang XPL0>includefunc c:\cxpl\codesPrime(N); \intrinsicReturn 'codetrue' declarationsif N is a prime number
 
func Prime(N); \Return 'true' if N is a prime number
int N;
int I;
[if N <= 1 then return false;
for I:= 32 to sqrt(N) do
if rem(N/I) = 0 then return false;
return true;
]; \Prime
 
int Num;
772

edits