Primality by trial division: Difference between revisions
Content deleted Content added
m rm linebreak |
→{{header|BBC BASIC}}: Added bc |
||
Line 331:
97 is prime
</pre>
=={{header|bc}}==
<lang bc>/* Return 1 if n is prime, 0 otherwise */
define p(n) {
auto i
if (n < 2) return(0)
if (n == 2) return(1)
if (n % 2 == 0) return(0)
for (i = 3; i * i <= n; i += 2) {
if (n % i == 0) return(0)
}
return(1)
}</lang>
=={{header|Bracmat}}==
|