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.

Showing 1-10 of 10 results.

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

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

N. J. A. Sloane, Sep 18 2001

Keywords

Comments

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.
a(n) <= A167618(n). - Reinhard Zumkeller, Nov 07 2009
Equivalently, number of ways of writing n as an unordered sum of exactly 3 triangular numbers. - Jon E. Schoenfield, Mar 28 2021

Examples

			0 : empty sum
1 : 1
2 : 1+1
3 : 3 = 1+1+1
4 : 3+1
5 : 3+1+1
6 : 6 = 3+3
7 : 6+1 = 3+3+1
...
13 : 10 + 3 = 6 + 6 + 1, so a(13) = 2.
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102, eq. (8).
  • D. H. Lehmer, Review of Loria article, Math. Comp. 2 (1947), 301-302.
  • 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.
  • Mel Nathanson, Additive Number Theory: The Classical Bases, Graduate Texts in Mathematics, Volume 165, Springer-Verlag, 1996. See Chapter 1.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    # reuses code in A000217
    A002636 := proc(n)
        local a,i,Ti, j,Tj, Tk ;
        a := 0 ;
        for i from 0 do
            Ti := A000217(i) ;
            if Ti > n then
                break ;
            end if;
            for j from i do
                Tj := A000217(j) ;
                if Ti+Tj > n then
                    break ;
                end if;
                Tk := n-Ti-Tj ;
                if Tk >= Tj and isA000217(Tk) then
                    a := a+1 ;
                end if;
                if Tk < Tj then
                    break ;
                end if;
            end do:
        end do:
        a ;
    end proc:
    seq(A002636(n),n=0..40) ; # R. J. Mathar, May 26 2025
  • Mathematica
    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
  • 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

Extensions

More terms from Robert G. Wilson v, Sep 20 2001
Entry revised by N. J. A. Sloane, Feb 25 2007

A319797 Number T(n,k) of partitions of n into exactly k positive triangular numbers; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 2, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 2, 1, 1, 1, 1, 1, 0, 1, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, Sep 28 2018

Keywords

Comments

Equals A181506 when the first column is removed. - Georg Fischer, Jul 26 2023

Examples

			Triangle T(n,k) begins:
  1;
  0, 1;
  0, 0, 1;
  0, 1, 0, 1;
  0, 0, 1, 0, 1;
  0, 0, 0, 1, 0, 1;
  0, 1, 1, 0, 1, 0, 1;
  0, 0, 1, 1, 0, 1, 0, 1;
  0, 0, 0, 1, 1, 0, 1, 0, 1;
  0, 0, 1, 1, 1, 1, 0, 1, 0, 1;
  0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1;
  0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1;
  0, 0, 1, 2, 1, 1, 1, 1, 1, 0, 1, 0, 1;
		

Crossrefs

Columns k=0-10 give: A000007, A010054 (for n>0), A052344, A063993, A319814, A319815, A319816, A319817, A319818, A319819, A319820.
Row sums give A007294.
T(2n,n) gives A319799.

Programs

  • Maple
    h:= proc(n) option remember; `if`(n<1, 0,
          `if`(issqr(8*n+1), n, h(n-1)))
        end:
    b:= proc(n, i) option remember; `if`(n=0 or i=1, x^n,
          b(n, h(i-1))+expand(x*b(n-i, h(min(n-i, i)))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b(n, h(n))):
    seq(T(n), n=0..20);
  • Mathematica
    h[n_] := h[n] = If[n < 1, 0, If[IntegerQ @ Sqrt[8*n + 1], n, h[n - 1]]];
    b[n_, i_] := b[n, i] = If[n == 0 || i == 1, x^n, b[n, h[i - 1]] + Expand[ x*b[n - i, h[Min[n - i, i]]]]];
    T[n_] := Table[Coefficient[#, x, i], {i, 0, n}]& @ b[n, h[n]];
    Table[T[n], {n, 0, 20}] // Flatten (* Jean-François Alcover, May 27 2019, after Alois P. Heinz *)

Formula

T(n,k) = [x^n y^k] 1/Product_{j>=1} (1-y*x^A000217(j)).

A307598 Number of partitions of n into 3 distinct positive triangular numbers.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 2, 0, 0, 1, 0, 1, 1, 1, 0, 2, 0, 1, 1, 2, 0, 1, 1, 0, 3, 0, 2, 1, 1, 1, 1, 2, 1, 2, 1, 0, 3, 1, 0, 4, 1, 2, 1, 1, 1, 2, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 1, 3, 2, 2, 2, 2, 1, 3, 2, 0, 4, 1, 1, 5, 1, 3, 2, 2, 3, 2, 2, 1, 4, 1, 2, 4, 2, 2, 3, 2, 1, 3, 2, 4, 3, 3, 2, 2, 3, 1, 6
Offset: 0

Views

Author

Ilya Gutkovskiy, Apr 17 2019

Keywords

Comments

The greedy inverse starts 0, 10, 19, 37, 52, 82, 109, 136, 241, 226, 217, 247, 364, 427, 457, 541, 532, 577, 637, 961, 721, 787, 1066, 1102, 1381, 1267, 1564, 1192, 1396, 1816, 1501, 1612, 1927, 1942, 2242, 1792, 2842, 2587, 2557, 2422, ... - R. J. Mathar, Apr 28 2020

Examples

			a(19) = 2 because we have [15, 3, 1] and [10, 6, 3].
		

Crossrefs

Formula

a(n) = [x^n y^3] Product_{k>=1} (1 + y*x^(k*(k+1)/2)).

A341774 Number of partitions of n into 3 nonzero tetrahedral numbers.

Original entry on oeis.org

1, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 2, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 1, 1, 0, 2, 0, 0, 2
Offset: 3

Views

Author

Ilya Gutkovskiy, Feb 19 2021

Keywords

Crossrefs

A002097 Numbers that are not the sum of 3 nonzero triangular numbers.

Original entry on oeis.org

1, 2, 4, 6, 11, 20, 29
Offset: 1

Views

Author

Keywords

Comments

A063993(a(n)) = 0. - Reinhard Zumkeller, Jul 20 2012

Crossrefs

Programs

  • Mathematica
    Complement[Range[30],Union[Total/@Tuples[Accumulate[Range[8]],3]]] (* Harvey P. Dale, Oct 06 2017 *)

A064825 Numbers which are the sums of three positive triangular numbers in exactly two different ways.

Original entry on oeis.org

12, 17, 19, 21, 22, 23, 26, 27, 28, 31, 32, 33, 34, 35, 39, 41, 42, 43, 44, 46, 47, 51, 54, 56, 62, 64, 65, 68, 74, 80, 88, 89, 90, 92, 95, 106, 113, 123, 128, 137, 141, 146, 153, 164, 179, 194, 200, 218, 245, 281, 326, 335
Offset: 1

Views

Author

Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 23 2001

Keywords

Comments

Checked up to 1000000 but haven't found any other values.
A063993(a(n)) = 2. - Reinhard Zumkeller, Jul 20 2012
Without the qualifier "positive" in the Name, sequence A071530 would result. - Jon E. Schoenfield, Jan 01 2020
No further terms <= 3*10^7. - Michael S. Branicky, Dec 17 2021

Examples

			19 = 10 + 6 + 3 = 15 + 3 + 1.
		

Crossrefs

Programs

  • Magma
    [k:k in [1..350]|#RestrictedPartitions(k, 3, {m*(m+1) div 2:m in [1..200]}) eq 2 ]; // Marius A. Burtea, Jan 01 2020
    
  • Python
    from collections import Counter
    from itertools import count, takewhile, combinations_with_replacement as mc
    def aupto(N):
        tris = takewhile(lambda x: x <= N, (i*(i+1)//2 for i in count(1)))
        sum3 = filter(lambda x: x <= N, (sum(c) for c in mc(tris, 3)))
        sum3counts = Counter(sum3)
        return sorted(k for k in sum3counts if sum3counts[k] == 2)
    print(aupto(1000)) # Michael S. Branicky, Dec 17 2021

Extensions

Offset changed to 1 by Michel Marcus, Jan 14 2014

A111638 Numbers having a unique partition into three positive triangular numbers.

Original entry on oeis.org

3, 5, 7, 8, 9, 10, 13, 14, 15, 16, 18, 24, 25, 36, 38, 50, 53, 55, 60, 69, 81, 83, 99, 110, 119
Offset: 1

Views

Author

T. D. Noe, Aug 10 2005

Keywords

Comments

A063993(a(n)) = 1. - Reinhard Zumkeller, Jul 20 2012

Examples

			Example: 119=55+36+28
		

Crossrefs

Cf. A060773 (n having a unique partition into three nonnegative triangular numbers).

Programs

  • Mathematica
    trig[n_]:=n(n+1)/2; trigInv[x_]:=Ceiling[Sqrt[Max[0, 2x]]]; lim=100; nLst=Table[0, {trig[lim]}]; Do[n=trig[a]+trig[b]+trig[c]; If[n>0 && n<=trig[lim], nLst[[n]]++ ], {a, 1, lim}, {b, a, trigInv[trig[lim]-trig[a]]}, {c, b, trigInv[trig[lim]-trig[a]-trig[b]]}]; Flatten[Position[nLst, 1]]

A064181 Smallest number that can be written in n ways as an unordered sum of 3 nonzero triangular numbers.

Original entry on oeis.org

0, 3, 12, 30, 61, 52, 82, 136, 142, 147, 192, 277, 247, 367, 552, 457, 516, 507, 646, 637, 721, 822, 787, 1171, 1066, 1137, 1227, 1402, 1192, 1396, 1696, 1501, 1612, 1876, 1927, 1792, 2551, 2587, 2926, 2761, 2422, 2947, 2887, 3262, 3271, 3412, 3937
Offset: 0

Views

Author

Robert G. Wilson v, Sep 20 2001

Keywords

Crossrefs

Cf. A063993.

Programs

  • Mathematica
    a = Table[ n(n + 1)/2, {n, 1, 100} ]; b = {0}; c = Table[ 0, {5000} ]; Do[ b = Append[ b, a[ [ i ] ] + a[ [ j ] ] + a[ [ k ] ] ], {k, 1, 100}, {j, 1, k}, {i, 1, j} ]; b = Delete[ b, 1 ]; b = Sort[ b ]; l = Length[ b ]; Do[ If[ b[ [ n ] ] < 5000, c[ [ b[ [ n ] ] + 1 ] ]++ ], {n, 1, l} ]; Do[ k = 1; While[ c[ [ k ] ] != n, k++ ]; Print[ k - 1 ], {n, 0, 54} ]

Extensions

More terms from Don Reble, Sep 21 2001

A330810 a(n) is the largest number that can be expressed as the sum of three triangular numbers in exactly n ways.

Original entry on oeis.org

53, 194, 470, 788, 1730, 2000, 2693, 4310, 6053, 6845, 10688, 11348, 13970, 12923, 20768, 17135, 27830, 26480, 36245, 31688, 37073, 39983, 57860, 46940, 49148, 68258, 62810, 66515, 76985, 73868, 82850, 123878, 87890, 119810, 111053, 118490, 118880, 119183
Offset: 1

Views

Author

Jon E. Schoenfield, Jan 01 2020

Keywords

Comments

One or more of the three triangular numbers may be zeros. If it were required that the triangular numbers be positive, sequence A330811 would result.

Crossrefs

A330811 a(n) is the largest number that can be expressed as the sum of three positive triangular numbers in exactly n ways.

Original entry on oeis.org

29, 119, 335, 713, 1730, 1328, 3413, 3485, 4565, 6053, 6950, 10688, 11348, 13970, 16778, 20768, 18173, 36245, 26480, 27203, 37073, 35033, 39983, 57860, 46940, 49148, 68258, 62810, 66515, 76985, 73868, 123878, 103403, 87890, 119810, 111053, 118490, 118880
Offset: 0

Views

Author

Jon E. Schoenfield, Jan 01 2020

Keywords

Comments

If the triangular numbers were not required to be positive, sequence A330810 would result.

Crossrefs

Showing 1-10 of 10 results.