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.

A034706 Numbers which are sums of consecutive triangular numbers.

This page as a plain text file.
%I A034706 #25 Oct 28 2023 11:43:42
%S A034706 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 A034706 66,74,78,80,81,83,84,85,91,100,105,109,110,116,119,120,121,130,136,
%U A034706 144,145,153,155,161,164,165,166,169,171,185,190,196,199,200,202,210
%N A034706 Numbers which are sums of consecutive triangular numbers.
%H A034706 Reinhard Zumkeller, <a href="/A034706/b034706.txt">Table of n, a(n) for n = 1..10000</a>
%H A034706 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 A034706 isA034706 := proc(n)
%p A034706     local a,b;
%p A034706     for a from 0 do
%p A034706         if a*(a+1)/2 > n then
%p A034706             return false;
%p A034706         end if;
%p A034706         for b from a do
%p A034706             tab := (1+b-a)*(a^2+b*a+a+b^2+2*b)/6 ;
%p A034706             if tab = n then
%p A034706                 return true;
%p A034706             elif tab > n then
%p A034706                 break;
%p A034706             end if;
%p A034706         end do:
%p A034706     end do:
%p A034706 end proc:
%p A034706 for n from 0 to 100 do
%p A034706     if isA034706(n) then
%p A034706         printf("%d,",n) ;
%p A034706     end if;
%p A034706 end do: # _R. J. Mathar_, Dec 14 2015
%t A034706 M = 1000; (* to get all terms <= M *)
%t A034706 nmax = (Sqrt[8 M + 1] - 1)/2 // Ceiling;
%t A034706 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 A034706 (Haskell)
%o A034706 -- import Data.Set (deleteFindMin, union, fromList); import Data.List (inits)
%o A034706 a034706 n = a034706_list !! (n-1)
%o A034706 a034706_list = f 0 (tail $ inits $ a000217_list) (fromList [0]) where
%o A034706    f x vss'@(vs:vss) s
%o A034706      | y < x = y : f x vss' s'
%o A034706      | otherwise = f w vss (union s $ fromList $ scanl1 (+) ws)
%o A034706      where ws@(w:_) = reverse vs
%o A034706            (y, s') = deleteFindMin s
%o A034706 -- _Reinhard Zumkeller_, May 12 2015
%Y A034706 Complement gives A050941.
%Y A034706 Cf. A000217 (1 consec), A001110 (2 consec), A129803 (3 consec), A131557 (5 consec),  A257711 (7 consec), A034705, A269414 (subsequence of primes).
%K A034706 nonn
%O A034706 1,3
%A A034706 _Erich Friedman_