cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A239071 #21 May 05 2021 18:25:21
%S A239071 0,2,6,11,19,39,53,84,104,122,146,195,225,285,321,352,392,434,470,516,
%T A239071 605,657,757,815,864,926,990,1044,1112,1241,1315,1455,1535,1602,1686,
%U A239071 1844,1934,2103,2199,2279,2379,2481,2566,2672,2870,2982,3191,3309,3407,3529
%N 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.
%C A239071 If k is a triangular number then y=k.
%C A239071 The sequence of terms that are triangular numbers begins: 0, 6, 990, 189420, 36709596, 7120958130, 1381422007290, 267988648725336, 51988415041636920, 10085484510081574110.
%C A239071 Those are the triangular numbers with indices from A011916. - _Ivan Neretin_, May 31 2015
%e A239071 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.
%t A239071 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 *)
%o A239071 (Python)
%o A239071 def isqrt(a):
%o A239071     sr = 1 << (int.bit_length(int(a)) >> 1)
%o A239071     while a < sr*sr:  sr>>=1
%o A239071     b = sr>>1
%o A239071     while b:
%o A239071         s = sr + b
%o A239071         if a >= s*s:  sr = s
%o A239071         b>>=1
%o A239071     return sr
%o A239071 def isTriang(x):
%o A239071     x+=x
%o A239071     r = isqrt(x)
%o A239071     return r*(r+1)==x
%o A239071 print('0', end=', ')
%o A239071 for n in range(777):
%o A239071     tn = n*(n+1)//2
%o A239071     tn1 = (n+1)*(n+2)//2
%o A239071     for t in range(tn+1, tn1+1):
%o A239071         if isTriang(tn+t+tn1): print(str(t), end=',')
%o A239071 (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
%Y A239071 Cf. A000217, A238489, A238599.
%K A239071 nonn
%O A239071 1,2
%A A239071 _Alex Ratushnyak_, Mar 10 2014