Sequence of primes by trial division: Difference between revisions
Content added Content deleted
(Sequence of primes by trial division in BASIC256) |
(Sequence of primes by trial division in Yabasic) |
||
Line 2,967: | Line 2,967: | ||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 |
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 |
||
</pre> |
</pre> |
||
=={{header|Yabasic}}== |
|||
<lang yabasic>sub isPrime(v) |
|||
if v < 2 then return False : fi |
|||
if mod(v, 2) = 0 then return v = 2 : fi |
|||
if mod(v, 3) = 0 then return v = 3 : fi |
|||
d = 5 |
|||
while d * d <= v |
|||
if mod(v, d) = 0 then return False else d = d + 2 : fi |
|||
wend |
|||
return True |
|||
end sub |
|||
for i = 101 to 999 |
|||
if isPrime(i) print str$(i), " "; |
|||
next i |
|||
end</lang> |
|||
{{out}} |
|||
<pre>Igual que la entrada de FreeBASIC.</pre> |
|||
=={{header|zkl}}== |
=={{header|zkl}}== |