OFFSET
1,1
COMMENTS
Bunyakovsky's conjecture implies that a(n) always exists. - Robert Israel, Dec 08 2019
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
N:= 10^4: # to get all terms before the first term > N
Primes:= select(isprime, [seq(i, i=3..N, 2)]):
A[1]:= 2:
for n from 2 do
found:= false;
for k from 1 to nops(Primes) do
if issqr(A[n-1]+Primes[k]) then
A[n]:= Primes[k];
Primes:= subsop(k=NULL, Primes);
found:= true;
break
fi
od;
if not found then break fi
od:
seq(A[i], i=1..n-1); # Robert Israel, Dec 08 2019
PROG
(PARI) { PS(a)= v=vector(a); v[1]=1; k=prime(1); print1(k", "); while(1, t=0; for(s=1, a, r=prime(s); if(v[s]==0 && issquare(k+r), t=r; v[s]=1; break)); if(t==0, break); print1(r", "); k=r) }
CROSSREFS
KEYWORD
nonn
AUTHOR
Jason Earls, May 28 2003
STATUS
approved