Primality by trial division: Difference between revisions
Content deleted Content added
mNo edit summary |
Basicgames (talk | contribs) |
||
Line 860: | Line 860: | ||
89 is prime |
89 is prime |
||
97 is prime</pre> |
97 is prime</pre> |
||
==={{header|Craft Basic}}=== |
|||
<syntaxhighlight lang="basic">for i = 1 to 50 |
|||
if i < 2 then |
|||
let p = 0 |
|||
else |
|||
if i = 2 then |
|||
let p = 1 |
|||
else |
|||
if i % 2 = 0 then |
|||
let p = 0 |
|||
else |
|||
let p = 1 |
|||
for j = 3 to int(i ^ .5) step 2 |
|||
if i % j = 0 then |
|||
let p = 0 |
|||
break j |
|||
endif |
|||
wait |
|||
next j |
|||
endif |
|||
endif |
|||
endif |
|||
if p <> 0 then |
|||
print i |
|||
endif |
|||
next i |
|||
end</syntaxhighlight> |
|||
==={{header|FBSL}}=== |
==={{header|FBSL}}=== |