Anonymous user
Semiprime: Difference between revisions
m
→version 2: added capital letters where appropriate. -- ~~~~
m (→version 2: added support for a range of numbers, added output. -- ~~~~) |
m (→version 2: added capital letters where appropriate. -- ~~~~) |
||
Line 177:
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────ISPRIME subroutine──────────────────*/
if wordpos(x,'2 3 5 7')\==0 then return 1;
do i=2 for 2; if x//i==0 then return 0; end /*i*/
Line 185:
return 1
/*──────────────────────────────────ISSEMIPRIME subroutine──────────────*/
x=x/1
do i=2 to 3; if x//i==0 then if
else return 0
end /*i*/
do j=5 by 6; if j*j>x then return 0
do k=j by 2 for 2; if x//k==0 then if
else return 0
end /*k*/
|