A234334 Numbers k such that both distances from k to two nearest squares are perfect squares.
0, 1, 5, 8, 25, 40, 45, 65, 80, 153, 160, 169, 200, 221, 325, 360, 416, 425, 493, 520, 625, 680, 725, 925, 936, 1025, 1040, 1073, 1088, 1305, 1360, 1681, 1768, 1800, 1813, 1845, 1961, 2000, 2320, 2385, 2501, 2600, 2925, 3016, 3185, 3200, 3400, 3445, 3721, 3848
Offset: 1
Examples
The two squares nearest to 25 are 16 and 25, because both 25-25=0 and 25-16=9 are squares, 25 is in the sequence. The two squares nearest to 45 are 36 and 49, because both 45-36=9 and 49-45=4 are squares, 45 is in the sequence.
Links
- Robert Israel, Table of n, a(n) for n = 1..6000
Programs
-
Maple
filter:= proc(n) local a; if issqr(n) then a:= sqrt(n)-1 else a:= floor(sqrt(n)) fi; issqr(n-a^2) and issqr((a+1)^2-n) end proc: select(filter, [$0..5000]); # Robert Israel, Jan 21 2021
-
Mathematica
filter[n_] := If[n == 0, True, Module[{a}, a = If[IntegerQ @ Sqrt[n], Sqrt[n]-1, Floor[Sqrt[n]]]; IntegerQ @ Sqrt[n-a^2] && IntegerQ@Sqrt[(a+1)^2-n]]]; Select[Range[0, 5000], filter] (* Jean-François Alcover, May 28 2023, after Robert Israel *)
Comments