OFFSET
1,1
COMMENTS
The sequence is infinite because there are terms of it between n^2 and (n+1)^2 whenever 2n+1 is a sum of two squares.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 40 because the two nearest squares are 36 and 49 and 40 - 36 = 4, 49 - 40 = 9 are both squares.
MATHEMATICA
Select[Range[6120], IntegerQ[Sqrt[# - (Floor[Sqrt[#]])^2]] && IntegerQ[Sqrt[(Ceiling[Sqrt[#]])^2 - #]] &]
PROG
(PARI) is(n)=my(k=sqrtint(n)); issquare(n-k^2) && issquare((k+1)^2-n) && n>k^2 \\ Charles R Greathouse IV, Feb 27 2017
(PARI) list(lim)=my(v=List(), k2, K2, n); for(k=2, sqrtint(lim\1)-1, k2=k^2; K2=(k+1)^2; for(s=1, sqrtint(K2-k2-1), n=k2+s^2; if(issquare(K2-n), listput(v, n)))); k2=sqrtint(lim\1)^2; K2=(sqrtint(lim\1)+1)^2; for(n=k2+1, lim, if(issquare(n-k2) && issquare(K2-n), listput(v, n))); Vec(v) \\ Charles R Greathouse IV, Feb 27 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Emmanuel Vantieghem, Feb 27 2017
STATUS
approved