Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Summarize-primes/Ring/summarize-primes.ring
Normal file
25
Task/Summarize-primes/Ring/summarize-primes.ring
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
load "stdlib.ring"
|
||||
see "working..." + nl
|
||||
see "Summarize primes:" + nl
|
||||
see "n sum" + nl
|
||||
row = 0
|
||||
sum = 0
|
||||
limit = 1000
|
||||
Primes = []
|
||||
|
||||
for n = 2 to limit
|
||||
if isprime(n)
|
||||
add(Primes,n)
|
||||
ok
|
||||
next
|
||||
|
||||
for n = 1 to len(Primes)
|
||||
sum = sum + Primes[n]
|
||||
if isprime(sum)
|
||||
row = row + 1
|
||||
see "" + n + " " + sum + nl
|
||||
ok
|
||||
next
|
||||
|
||||
see "Found " + row + " numbers" + nl
|
||||
see "done..." + nl
|
||||
Loading…
Add table
Add a link
Reference in a new issue