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-2 of 2 results.

A100878 Smallest number of pentagonal numbers which sum to n.

Original entry on oeis.org

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

Views

Author

Franz Vrabec, Jan 09 2005

Keywords

Comments

From Bernard Schott, Jul 15 2022: (Start)
In September 1636, Fermat, in a letter to Mersenne, made the statement that every number is a sum of at most three triangular numbers, four squares, five pentagonal numbers, and so on.
The square case was proved by Lagrange in 1770; it is known as Lagrange's four squares theorem (see A002828). Then Gauss proved the triangular case in 1796 (see A061336).
In 1813, Cauchy proved this polygonal number theorem: for m >= 3, every positive integer N can be represented as a sum of m+2 (m+2)-gonal numbers, at most four of which are different from 0 and 1 (Deza reference). Hence every number is expressible as the sum of at most five positive pentagonal numbers (A000326). (End)

Examples

			a(5)=1 since 5=5, a(6)=2 since 6=1+5, a(7)=3 since 7=1+1+5, a(10)=2 since 10=5+5 with 1 and 5 pentagonal numbers.
		

References

  • Elena Deza and Michel Marie Deza, Fermat's polygonal number theorem, Figurate numbers, World Scientific Publishing (2012), Chapter 5, pp. 313-377.
  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section D3, Figurate numbers, pp. 222-228.

Crossrefs

Cf. A000326 (a(n) = 1), A003679 (a(n) = 4 or 5), A355660 (a(n) = 4), A133929 (a(n) = 5).

Programs

  • PARI
    a(n) = my(nb=oo); forpart(vp=n, if (vecsum(apply(x->ispolygonal(x, 5), Vec(vp))) == #vp, nb = min(nb, #vp)),,5); nb; \\ Michel Marcus, Jul 15 2022
    
  • PARI
    a(n) = for(i = 1, oo, p = partitions(n, , [i,i]); for(j = 1, #p, if(sum(k = 1, i, ispolygonal(p[j][k],5)) == i, return(i)))) \\ David A. Corneth, Jul 15 2022

Formula

a(n) <= 5 (inequality proposed by Fermat and proved by Cauchy). - Bernard Schott, Jul 13 2022

Extensions

More terms from David Wasserman, Mar 04 2008

A355774 An extension of the generalized pentagonal numbers such that every positive integer can be represented as the sum of at most two terms of the sequence.

Original entry on oeis.org

0, 1, 2, 5, 7, 11, 12, 15, 21, 22, 25, 26, 35, 39, 40, 49, 51, 57, 67, 70, 77, 87, 92, 100, 117, 120, 123, 126, 145, 153, 155, 173, 176, 182, 186, 187, 205, 210, 214, 222, 228, 241, 247, 251, 260, 283, 287, 301, 319, 330, 345, 376, 382, 392, 425, 435, 442, 448
Offset: 0

Views

Author

Peter Luschny, Jul 17 2022

Keywords

Comments

The sequence is defined inductively. Starting from the empty sequence, the terms are added one after the other. A term is added if it is a generalized pentagonal number or if it cannot be represented as the sum of two preceding terms. Note that these exceptions form a proper subsequence of A093519.
Thus any positive number can be expressed as the sum of at most two positive terms by Euler's Pentagonal Number Theorem. Every pentagonal number and every generalized pentagonal number is in this sequence.

Examples

			32 = 7 + 25; 195 = 22 + 173.
		

Crossrefs

Cf. A000326, A001318, A093519, A100878, A355717, A176747 (same construction with triangular numbers).

Programs

  • Maple
    A355774_list := proc(upto) local P, k, issum, isgpn; P := [];
    isgpn := k -> ormap(n -> 0 = 8*k-(n+irem(n,2))*(3*n+2-irem(n,2)), [$0..k]);
    issum := k -> ormap(p -> member(k - p, P), P);
    for k from 0 to upto do
        if isgpn(k) or not issum(k) then P := [op(P), k] fi od;
    P end: print(A355774_list(448));
  • Mathematica
    isgpn[k_] := AnyTrue[Range[0, k], 0 == 8*k-(#+Mod[#,2])*(3*#+2-Mod[#,2])&];
    issum[k_] := AnyTrue[P, MemberQ[P, k-#]&];
    P = {};
    For[k = 0, k <= 448, k++, If[isgpn[k] || !issum[k], AppendTo[P, k]]];
    P (* Jean-François Alcover, Mar 07 2024, after Peter Luschny *)
  • Python
    def A355774_list(upto: int) -> list[int]:
        P: list[int] = []
        for k in range(upto + 1):
            if any(
                k == ((n + n % 2) * (3 * n + 2 - n % 2)) >> 3
                for n in range(k + 1)
            ) or not any([(k - p) in P for p in P]):
                P.append(k)
        return P
    print(A355774_list(448))
Showing 1-2 of 2 results.