Jump to content

Summation of primes: Difference between revisions

Line 560:
142913828922
</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>
672

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.