Frobenius numbers
Frobenius numbers is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
a(n) = prime(n)*prime(n+1) - prime(n) - prime(n+1), where prime(n) < 10,000
Ring
<lang ring> load "stdlib.ring"
decimals(0) see "working..." + nl see "Frobenius numbers are:" + nl
row = 0 limit1 = 101 Frob = []
for n = 1 to limit1
if isprime(n) add(Frob,n) ok
next
for n = 1 to len(Frob)-1
row = row + 1 fr = Frob[n]*Frob[n+1]-Frob[n]-Frob[n+1] see "" + fr + " " if row%5 = 0 see nl ok
next
see "Found " + row + " Frobenius primes" + nl see "done..." + nl </lang>
- Output:
working... Frobenius primes are: 1 7 23 59 119 191 287 395 615 839 1079 1439 1679 1931 2391 3015 3479 3959 4619 5039 5615 6395 7215 8447 9599 Found 25 Frobenius primes done...