A239071 Numbers k such that k+x+y is a triangular number (A000217), where x and y are the two triangular numbers nearest to k.
0, 2, 6, 11, 19, 39, 53, 84, 104, 122, 146, 195, 225, 285, 321, 352, 392, 434, 470, 516, 605, 657, 757, 815, 864, 926, 990, 1044, 1112, 1241, 1315, 1455, 1535, 1602, 1686, 1844, 1934, 2103, 2199, 2279, 2379, 2481, 2566, 2672, 2870, 2982, 3191, 3309, 3407, 3529
Offset: 1
Keywords
Examples
The two triangular numbers nearest to 11 are 10 and 15. Because 10+11+15=36 is a triangular number, 11 is in the sequence.
Programs
-
Mathematica
Module[{nn=3600,trnos},trnos=Accumulate[Range[100]];Join[{0},Select[ Range[ nn],OddQ[Sqrt[8(Total[Nearest[trnos,#,2]]+#) +1]]&]]] (* Harvey P. Dale, Dec 19 2020 *)
-
PARI
isok(k) = {my(x = k-1); while (! ispolygonal(x, 3), x--); my(y = k); while (! ispolygonal(y, 3), y++); ispolygonal(k+x+y, 3);} \\ Michel Marcus, May 31 2015
-
Python
def isqrt(a): sr = 1 << (int.bit_length(int(a)) >> 1) while a < sr*sr: sr>>=1 b = sr>>1 while b: s = sr + b if a >= s*s: sr = s b>>=1 return sr def isTriang(x): x+=x r = isqrt(x) return r*(r+1)==x print('0', end=', ') for n in range(777): tn = n*(n+1)//2 tn1 = (n+1)*(n+2)//2 for t in range(tn+1, tn1+1): if isTriang(tn+t+tn1): print(str(t), end=',')
Comments