OFFSET
1,1
COMMENTS
a(n+1) is the smallest prime p > a(n) such that none of sums a(i)+p, i=1..n is a square.
The sequence is infinite.
LINKS
Zak Seidov, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 5 because 2 + 5 = 7 (not a square) and 3 + 5 = 8 (a cube, not a square).
7 is not in the sequence because 2 + 7 = 3^2. With 11, we have 11 + 5 = 4^2, and for 13, there is 3 + 13 = 4^2.
a(4) = 17, as 2 + 17 = 19 (a prime), 3 + 17 = 20 (divisible by a square but not itself a square) and 5 + 17 = 22 (a squarefree semiprime).
MATHEMATICA
t = {2}; currPrime = 2; len = 1; maxLen = 100; Do[Label[ne]; currPrime = NextPrime[currPrime]; Do[If[IntegerQ[Sqrt[t[[i]] + currPrime]], Goto[ne]], {i, len}]; AppendTo[t, currPrime]; len++, {maxLen - 1}]; t
PROG
(PARI) list(lim)=my(v=List([2])); forprime(p=3, lim, if(issquare(p+2), next); for(k=sqrtint(p+2)+1, sqrtint(2*p-2), if(setsearch(v, k^2-p), next(2))); listput(v, p)); Vec(v) \\ Charles R Greathouse IV, Feb 14 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Jul 27 2012
STATUS
approved