A229133 Numbers k such that the distance between the k-th triangular number and the nearest square is a square.
1, 2, 4, 5, 6, 8, 9, 13, 15, 17, 25, 32, 39, 49, 52, 54, 56, 63, 64, 80, 87, 89, 90, 95, 98, 100, 104, 111, 128, 135, 144, 148, 152, 153, 159, 176, 183, 189, 200, 207, 224, 225, 230, 231, 233, 248, 255, 272, 279, 285, 288, 296, 303, 305, 319, 320, 327, 329, 344, 351, 368, 369, 370, 374, 375
Offset: 1
Keywords
Examples
The nearest square to 6*7/2=21 is 25 and |21-25| = 2^2 so 6 is in the sequence. The nearest square to 7*8/2=28 is 25 and |28-25| = 3 so 7 is not in the sequence.
Programs
-
Mathematica
tnsQ[n_]:=Module[{tno=(n(n+1))/2,sr,a,b},sr=Sqrt[tno];a=tno-Floor[sr]^2;b=Ceiling[sr]^2-tno;IntegerQ[Sqrt[Min[{a,b}]]]]; Select[Range[400],tnsQ] (* Harvey P. Dale, Mar 26 2015 *)
Comments