Primality by trial division: Difference between revisions
Content added Content deleted
(→{{header|ZX Spectrum Basic}}: - Do not jump out of a loop on the ZX Spectrum - Unterminated loops use stack space) |
No edit summary |
||
Line 615: | Line 615: | ||
0 |
0 |
||
</pre> |
</pre> |
||
=={{header|Objeck}}== |
|||
<lang objeck> |
|||
function : IsPrime(n : Int) ~ Bool { |
|||
if(n <= 1) { |
|||
return false; |
|||
}; |
|||
for(i := 2; i * i <= n; i += 1;) { |
|||
if(n % i = 0) { |
|||
return false; |
|||
}; |
|||
}; |
|||
return true; |
|||
} |
|||
</lang> |
|||
=={{header|OCaml}}== |
=={{header|OCaml}}== |