A089982 Triangular numbers that can be expressed as the sum of 2 positive triangular numbers.
6, 21, 36, 55, 66, 91, 120, 136, 171, 210, 231, 276, 351, 378, 406, 496, 561, 666, 703, 741, 820, 861, 946, 990, 1035, 1081, 1176, 1225, 1326, 1378, 1431, 1485, 1540, 1596, 1653, 1711, 1770, 1891, 1953, 2016, 2080, 2211, 2278, 2346, 2556, 2701, 2775, 2850
Offset: 1
Examples
Generally, A000217(A000217(n)) = A000217(A000217(n)-1) + A000217(n) and so is automatically included. These are 6=T(3), 21=T(6), 55=T(10), etc. Other solutions occur when a partial sum from x to y is triangular, e.g., 15 + 16 + 17 + 18 = 66 = T(11), so T(14) + T(11) = T(18). This particular example arises since 10+4k is triangular (at k=14, 10 + 4k = 66), and we therefore have a solution. All other solutions occur when 3+2k, 6+3k, 10+4k, etc. -- in general, T(j) + j*k -- is triangular.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..11915
Programs
-
Mathematica
trn[i_]:=Module[{trnos=Accumulate[Range[i]],t2s},t2s=Union[Total/@ Tuples[ trnos,2]];Intersection[trnos,t2s]] (* Harvey P. Dale, Nov 08 2011 *) Select[Range[75], ! PrimeQ[#^2 + (# + 1)^2] &] /. Integer_ -> (Integer^2 + Integer)/2 (* Arkadiusz Wesolowski, Dec 03 2015 *)
-
PARI
t(i) = i*(i+1)/2; { v=vector(100,i,t(i)); y=vector(100); c=0; for (i=1,30, for (j=i,30, x=t(i)+t(j); f=0; for (k=1,100,if (x==v[k],f=1;break)); if (f==1,y[c++ ]=x))); select(x->(x>0), vecsort(y,,8)) } \\ slightly edited by Michel Marcus, Apr 15 2021
-
PARI
lista(nn) = {for (n=1, nn, my(t = n*(n+1)/2); for (k=1, n-1, if (ispolygonal(t - k*(k+1)/2, 3), print1(t, ", "); break;)););} \\ Michel Marcus, Apr 15 2021
-
Python
from itertools import count, takewhile def aupto(lim): t = list(takewhile(lambda x: x<=lim, (i*(i+1)//2 for i in count(1)))) s = set(a+b for i, a in enumerate(t) for b in t[i:]) return sorted(s & set(t)) print(aupto(3000)) # Michael S. Branicky, Jun 21 2021
Formula
Triangular number m is in this sequence iff A000161(4*m+1)>1 or, alternatively, A083025(4*m+1)>1. - Max Alekseyev, Oct 24 2008
Extensions
More terms from Lambert Klasen (Lambert.Klasen(AT)gmx.net) and David Wasserman, Sep 23 2005
Comments