|
MAPLE
|
g:=1/(product(1-x^ithprime(j), j=1..500)): gser:= series(g, x=0, 3575): a:= proc (n) if isprime(coeff(gser, x, ithprime(n)))=true then ithprime(n) else end if end proc: seq(a(n), n=1..3570); [From Emeric Deutsch (deutsch(AT)duke.poly.edu), Nov 09 2008]
Contribution from Alois P. Heinz (heinz(AT)hs-heilbronn.de), Jun 26 2009: (Start)
b:= proc(n, i) local r, m; if n<0 or i<2 then 0 elif n<6 or i<6 then m:= iquo (n, 30, 'r'); (5+15*m+r)*m+ [1, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 9, 9, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19][r+1] else b(n, i):= b(n-i, i) +b(n, prevprime(i)) fi end:
a:= proc(n) local k; k:= `if` (n=1, 3, nextprime (a(n-1))); while not (isprime (b(k, k))) do k:= nextprime(k) od; a(n):= k end: seq (a(n), n=1..15); (End)
|