login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers k such that triangular(k) - x and y - triangular(k) are both triangular numbers (A000217), where x is the nearest square below triangular(k), y is the nearest square above triangular(k).
3

%I #19 May 05 2021 13:39:48

%S 1,4,5,19,22,25,40,64,85,89,110,124,127,148,263,552,688,700,705,790,

%T 1804,2101,4009,4108,8680,11830,15889,22125,23611,23710,27571,32902,

%U 34536,39520,47327,62329,68374,98896,100933,112660,137614,137989,138191,159124,205004

%N Numbers k such that triangular(k) - x and y - triangular(k) are both triangular numbers (A000217), where x is the nearest square below triangular(k), y is the nearest square above triangular(k).

%C Intersection of A234141 and A234142.

%C The sequence of triangular(a(n)) begins: 1, 10, 15, 190, 253, 325, 820, 2080, 3655, 4005, 6105, 7750, 8128, ...

%e Triangular(4) = 4*5/2 = 10. The nearest squares above and below 10 are 9 and 16. Because both 10-9=1 and 16-10=6 are triangular numbers, 4 is in the sequence.

%t btnQ[n_]:=Module[{tr=(n(n+1))/2,x,y},x=Floor[Sqrt[tr]]^2;y=Ceiling[ Sqrt[ tr]]^2;!IntegerQ[Sqrt[tr]]&&AllTrue[{Sqrt[1+8(tr-x)],Sqrt[1+ 8(y-tr)]}, OddQ]]; Join[{1},Select[Range[205100],btnQ]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Aug 12 2020 *)

%o (Python)

%o import math

%o def isTriangular(n): # OK for relatively small n

%o n+=n

%o sr = int(math.sqrt(n))

%o return (n==sr*(sr+1))

%o for n in range(1,264444):

%o tn = n*(n+1)//2

%o r = int(math.sqrt(tn-1))

%o i = tn-r*r

%o r = int(math.sqrt(tn))

%o j = (r+1)*(r+1)-tn

%o if isTriangular(i) and isTriangular(j): print(str(n), end=',')

%Y Cf. A000217, A000290, A234141, A234142.

%K nonn

%O 1,2

%A _Alex Ratushnyak_, Dec 19 2013

%E Name corrected by _Alex Ratushnyak_, Jun 02 2016