OFFSET
1,2
COMMENTS
If k is a triangular number then y=k.
The sequence of terms that are triangular numbers begins: 0, 6, 990, 189420, 36709596, 7120958130, 1381422007290, 267988648725336, 51988415041636920, 10085484510081574110.
Those are the triangular numbers with indices from A011916. - Ivan Neretin, May 31 2015
EXAMPLE
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.
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 *)
PROG
(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=', ')
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Mar 10 2014
STATUS
approved