login
A280965
Nonsquares whose distances to the two nearest squares are squares.
1
5, 8, 40, 45, 65, 80, 153, 160, 200, 221, 325, 360, 416, 425, 493, 520, 680, 725, 925, 936, 1025, 1040, 1073, 1088, 1305, 1360, 1768, 1800, 1813, 1845, 1961, 2000, 2320, 2385, 2501, 2600, 2925, 3016, 3185, 3200, 3400, 3445, 3848, 3869, 3944, 3965, 4640, 4745, 5185, 5248, 5265, 5328, 5525, 5576, 5785, 5920, 6120
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
Sequence in context: A075273 A176859 A176757 * A151349 A298935 A258786
KEYWORD
nonn
AUTHOR
Emmanuel Vantieghem, Feb 27 2017
STATUS
approved