Summation of primes: Difference between revisions
Content added Content deleted
Line 560: | Line 560: | ||
142913828922 |
142913828922 |
||
</pre> |
</pre> |
||
=={{header|Yabasic}}== |
|||
{{trans|Python}} |
|||
<lang Yabasic>// Rosetta Code problem: http://rosettacode.org/wiki/Summation_of_primes |
|||
// by Galileo, 04/2022 |
|||
sub isPrime(n) |
|||
local i |
|||
for i = 2 to int(n**0.5) + 1 |
|||
if mod(n, i) = 0 return False |
|||
next |
|||
return True |
|||
end sub |
|||
suma = 2 |
|||
for i = 3 to 2000000 step 2 |
|||
if isPrime(i) suma = suma + i |
|||
next |
|||
print str$(suma, "%12.f")</lang> |