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 which are sums of consecutive triangular numbers.
14

%I #25 Oct 28 2023 11:43:42

%S 0,1,3,4,6,9,10,15,16,19,20,21,25,28,31,34,35,36,45,46,49,52,55,56,64,

%T 66,74,78,80,81,83,84,85,91,100,105,109,110,116,119,120,121,130,136,

%U 144,145,153,155,161,164,165,166,169,171,185,190,196,199,200,202,210

%N Numbers which are sums of consecutive triangular numbers.

%H Reinhard Zumkeller, <a href="/A034706/b034706.txt">Table of n, a(n) for n = 1..10000</a>

%H D. Subramaniam, E. Trevino, and P. Pollack, <a href="http://math.colgate.edu/~integers/uproc15/uproc15.pdf">On sums of consecutive triangular numbers</a>, INTEGERS 20A (2020) A15.

%p isA034706 := proc(n)

%p local a,b;

%p for a from 0 do

%p if a*(a+1)/2 > n then

%p return false;

%p end if;

%p for b from a do

%p tab := (1+b-a)*(a^2+b*a+a+b^2+2*b)/6 ;

%p if tab = n then

%p return true;

%p elif tab > n then

%p break;

%p end if;

%p end do:

%p end do:

%p end proc:

%p for n from 0 to 100 do

%p if isA034706(n) then

%p printf("%d,",n) ;

%p end if;

%p end do: # _R. J. Mathar_, Dec 14 2015

%t M = 1000; (* to get all terms <= M *)

%t nmax = (Sqrt[8 M + 1] - 1)/2 // Ceiling;

%t Table[Sum[n(n+1)/2, {n, j, k}], {j, 0, nmax}, {k, j, nmax}] // Flatten // Union // Select[#, # <= M&]& (* _Jean-François Alcover_, Mar 10 2019 *)

%o (Haskell)

%o -- import Data.Set (deleteFindMin, union, fromList); import Data.List (inits)

%o a034706 n = a034706_list !! (n-1)

%o a034706_list = f 0 (tail $ inits $ a000217_list) (fromList [0]) where

%o f x vss'@(vs:vss) s

%o | y < x = y : f x vss' s'

%o | otherwise = f w vss (union s $ fromList $ scanl1 (+) ws)

%o where ws@(w:_) = reverse vs

%o (y, s') = deleteFindMin s

%o -- _Reinhard Zumkeller_, May 12 2015

%Y Complement gives A050941.

%Y Cf. A000217 (1 consec), A001110 (2 consec), A129803 (3 consec), A131557 (5 consec), A257711 (7 consec), A034705, A269414 (subsequence of primes).

%K nonn

%O 1,3

%A _Erich Friedman_