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.

A002636 Number of ways of writing n as an unordered sum of at most 3 nonzero triangular numbers.

This page as a plain text file.
%I A002636 M0076 N0027 #43 May 26 2025 07:34:29
%S A002636 1,1,1,2,1,1,2,2,1,2,2,1,3,2,1,2,3,2,2,2,1,4,3,2,2,2,2,3,3,1,4,4,2,2,
%T A002636 3,2,3,4,2,3,3,2,4,3,2,4,4,2,4,4,1,4,5,1,2,3,4,6,4,3,2,5,2,3,3,3,6,5,
%U A002636 2,2,5,3,5,4,2,4,5,3,4,5,2,4,6,2,6,3,3,6,3,2,3,7,3,6,6,2,4,6,3,2
%N A002636 Number of ways of writing n as an unordered sum of at most 3 nonzero triangular numbers.
%C A002636 Fermat asserted that every number is the sum of three triangular numbers. This was proved by Gauss, who recorded in his Tagebuch entry for Jul 10 1796 that: EYPHKA! num = DELTA + DELTA + DELTA.
%C A002636 a(n) <= A167618(n). - _Reinhard Zumkeller_, Nov 07 2009
%C A002636 Equivalently, number of ways of writing n as an unordered sum of exactly 3 triangular numbers. - _Jon E. Schoenfield_, Mar 28 2021
%D A002636 J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102, eq. (8).
%D A002636 D. H. Lehmer, Review of Loria article, Math. Comp. 2 (1947), 301-302.
%D A002636 G. Loria, Sulla scomposizione di un intero nella somma di numeri poligonali. (Italian) Atti Accad. Naz. Lincei. Rend. Cl. Sci. Fis. Mat. Nat. (8) 1, (1946). 7-15.
%D A002636 Mel Nathanson, Additive Number Theory: The Classical Bases, Graduate Texts in Mathematics, Volume 165, Springer-Verlag, 1996. See Chapter 1.
%D A002636 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D A002636 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A002636 T. D. Noe, <a href="/A002636/b002636.txt">Table of n, a(n) for n = 0..10000</a>
%H A002636 Gino Loria, <a href="/A002635/a002635.pdf"> Sulla scomposizione di un intero nella somma di numeri poligonali. (Italian).</a> Atti Accad. Naz. Lincei. Rend. Cl. Sci. Fis. Mat. Nat. (8) 1, (1946). 7-15. Also D. H. Lehmer, Review of Loria article, Math. Comp. 2 (1947), 301-302. [Annotated scanned copies]
%H A002636 Eric T. Mortenson, <a href="https://arxiv.org/abs/1702.01627">A Kronecker-type identity and the representations of a number as a sum of three squares</a>, arXiv:1702.01627 [math.NT], 2017.
%H A002636 James A. Sellers, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL7/Sellers/sellers58.html">Partitions Excluding Specific Polygonal Numbers As Parts</a>, Journal of Integer Sequences, Vol. 7 (2004), Article 04.2.4.
%e A002636 0 : empty sum
%e A002636 1 : 1
%e A002636 2 : 1+1
%e A002636 3 : 3 = 1+1+1
%e A002636 4 : 3+1
%e A002636 5 : 3+1+1
%e A002636 6 : 6 = 3+3
%e A002636 7 : 6+1 = 3+3+1
%e A002636 ...
%e A002636 13 : 10 + 3 = 6 + 6 + 1, so a(13) = 2.
%p A002636 # reuses code in A000217
%p A002636 A002636 := proc(n)
%p A002636     local a,i,Ti, j,Tj, Tk ;
%p A002636     a := 0 ;
%p A002636     for i from 0 do
%p A002636         Ti := A000217(i) ;
%p A002636         if Ti > n then
%p A002636             break ;
%p A002636         end if;
%p A002636         for j from i do
%p A002636             Tj := A000217(j) ;
%p A002636             if Ti+Tj > n then
%p A002636                 break ;
%p A002636             end if;
%p A002636             Tk := n-Ti-Tj ;
%p A002636             if Tk >= Tj and isA000217(Tk) then
%p A002636                 a := a+1 ;
%p A002636             end if;
%p A002636             if Tk < Tj then
%p A002636                 break ;
%p A002636             end if;
%p A002636         end do:
%p A002636     end do:
%p A002636     a ;
%p A002636 end proc:
%p A002636 seq(A002636(n),n=0..40) ; # _R. J. Mathar_, May 26 2025
%t A002636 a = Table[ n(n + 1)/2, {n, 0, 15} ]; b = {0}; c = Table[ 0, {100} ]; Do[ b = Append[ b, a[ [ i ] ] + a[ [ j ] ] + a[ [ k ] ] ], {k, 1, 15}, {j, 1, k}, {i, 1, j} ]; b = Delete[ b, 1 ]; b = Sort[ b ]; l = Length[ b ]; Do[ If[ b[ [ n ] ] < 100, c[ [ b[ [ n ] ] + 1 ] ]++ ], {n, 1, l} ]; c
%o A002636 (PARI) first(n)=my(v=vector(n+1),A,B,C); for(a=0,n, A=a*(a+1)/2; if(A>n, break); for(b=0,a, B=A+b*(b+1)/2; if(B>n, break); for(c=0,b, C=B+c*(c+1)/2; if(C>n, break); v[C+1]++))); v \\ _Charles R Greathouse IV_, Jun 23 2017
%Y A002636 Cf. A007294, A053604, A008443, A063993, A061262.
%K A002636 nonn,easy,nice
%O A002636 0,4
%A A002636 _N. J. A. Sloane_, Sep 18 2001
%E A002636 More terms from _Robert G. Wilson v_, Sep 20 2001
%E A002636 Entry revised by _N. J. A. Sloane_, Feb 25 2007