The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
GC = 3
Array.SetValue("Primes",1,2)
Array.SetValue("Primes",2,3)
Array.SetValue("Primes",3,5)
For i = 7 To 2000000 Step 2
'If Math.Remainder(i,10011) = 0 Then
' TextWindow.WriteLine(i)
'EndIf
If Math.Remainder(i,5) = 0 Then
Goto Skip
EndIf
CheckPrime()
If isPrime = "True" Then
'TextWindow.WriteLine(i + " Prime found")
GC = GC + 1
Array.SetValue("Primes",GC,i)
sum = sum + i
EndIf
Skip:
EndFor
Sub CheckPrime
isPrime = "True"
For j = 1 To GC
If( Array.GetValue("Primes",j) * Array.GetValue("Primes",j) > i ) Then
Goto EndLoop
EndIf
If Math.Remainder(i, Array.GetValue("Primes",j)) = 0 Then
isPrime = "False"
Goto EndLoop
EndIf
EndFor
EndLoop:
EndSub
TextWindow.WriteLine("All primes under 2,000,000 added together is " + (sum+10) )
Century 21 Broker Properti Jual Beli Sewa Rumah Indonesia
artstones-by-debArtstones by Deb ,
madinah mediaMadinah Media,
mundy and yazdiMundy and Yazdi,
i am real estateI am Real Estate,
stephenson entertainmentStephenson Entertainment,
north star ltcNorth Star LTC,
intek 21Intek 21,
best health 101Best Health 101,
affordable passportAffordable Passport,
community substance abuseCommunity Substance Abuse,
yanni tributeYanni Tribute