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.

A061336 Smallest number of triangular numbers which sum to n.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Apr 25 2001

Keywords

Comments

a(n)=3 if n=5 or 8 mod 9, since triangular numbers are {0,1,3,6} mod 9.
From Bernard Schott, Jul 16 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. This was proved by Gauss, who noted this event in his diary on July 10 1796 with the notation:
EYPHKA! num = DELTA + DELTA + DELTA (where Y is in fact the Greek letter Upsilon and DELTA is the Greek letter of that name).
This proof was published in his book Disquisitiones Arithmeticae, Leipzig, 1801. (End)

Examples

			a(3)=1 since 3=3, a(4)=2 since 4=1+3, a(5)=3 since 5=1+1+3, with 1 and 3 being triangular.
		

References

  • Elena Deza and Michel Marie Deza, Fermat's polygonal number theorem, Figurate numbers, World Scientific Publishing (2012), Chapter 5, pp. 313-377.
  • C. F. Gauss, Disquisitiones Arithmeticae, Yale University Press, 1966, New Haven and London, p. 342, art. 293.

Crossrefs

Cf. A100878 (analog for A000326), A104246 (analog for A000292), A283365 (analog for A000332), A283370 (analog for A000389).

Programs

  • Mathematica
    t[n_]:=n*(n+1)/2; a[0]=0; a[n_]:=Block[ {k=1, tt= t/@ Range[Sqrt[2*n]]}, Off[IntegerPartitions::take]; While[{} == IntegerPartitions[n, {k}, tt, 1], k++]; k]; a/@ Range[0, 104] (* Giovanni Resta, Jun 09 2015 *)
  • PARI
    \\ see A283370 for generic code, working but not optimized for this case of triangular numbers. - M. F. Hasler, Mar 06 2017
    
  • PARI
    a(n)=my(m=n%9,f); if(m==5 || m==8, return(3)); f=factor(4*n+1); for(i=1,#f~, if(f[i,2]%2 && f[i,1]%4==3, return(3))); if(ispolygonal(n,3), n>0, 2) \\ Charles R Greathouse IV, Mar 17 2022

Formula

a(n) = 0 if n=0, otherwise 1 if n is in A000217, otherwise 2 if n is in A051533, otherwise 3 in which case n is in A020757.
a(n) <= 3 (proposed by Fermat and proved by Gauss). - Bernard Schott, Jul 16 2022

A338494 Least number of pentagonal pyramidal numbers needed to represent n.

Original entry on oeis.org

1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7, 3, 4, 3, 4, 5, 6, 2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 8, 4, 5, 4, 5, 6, 1, 2, 3, 4, 5, 2, 2, 3, 4, 5, 6, 3, 3, 4, 5, 5, 6, 4, 2, 3, 4, 5, 6, 3, 3, 4, 5
Offset: 1

Views

Author

Ilya Gutkovskiy, Oct 30 2020

Keywords

Crossrefs

A338480 Least number of heptagonal numbers needed to represent n.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Oct 29 2020

Keywords

Crossrefs

A338479 Least number of hexagonal numbers needed to represent n.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Oct 29 2020

Keywords

Crossrefs

A338481 Least number of octagonal numbers needed to represent n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 1, 2, 3, 3, 4, 5, 6, 7, 2, 3, 4, 4, 5, 6, 7, 8, 3, 4, 5, 1, 2, 2, 3, 4, 4, 5, 6, 2, 3, 3, 4, 5, 5, 6, 7, 3, 4, 4, 5, 6, 2, 3, 3, 4, 1, 2, 3, 4, 3, 4, 4, 5, 2, 3, 4, 5, 4, 5, 5, 2, 3, 3, 4, 4, 5, 2, 3, 3, 4, 4, 5, 5, 6, 3, 4, 1, 2, 3, 4, 5, 3
Offset: 1

Views

Author

Ilya Gutkovskiy, Oct 29 2020

Keywords

Crossrefs

A133929 Positive integers that cannot be expressed using four pentagonal numbers.

Original entry on oeis.org

9, 21, 31, 43, 55, 89
Offset: 1

Views

Author

Eric W. Weisstein, Sep 29 2007

Keywords

Comments

Equivalently, integers m such that the smallest number of pentagonal numbers (A000326) which sum to m is exactly five, that is, A100878(a(n)) = 5. Richard Blecksmith & John Selfridge found these six integers among the first million, they believe that they have found them all (Richard K. Guy reference). - Bernard Schott, Jul 22 2022

Examples

			   9 =  5 +  1 + 1 + 1 + 1.
  21 =  5 +  5 + 5 + 5 + 1.
  31 = 12 + 12 + 5 + 1 + 1.
  43 = 35 +  5 + 1 + 1 + 1.
  55 = 51 +  1 + 1 + 1 + 1.
  89 = 70 + 12 + 5 + 1 + 1.
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section D3, Figurate numbers, pp. 222-228.

Crossrefs

A338491 Least number of centered pentagonal numbers needed to represent n.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Oct 30 2020

Keywords

Crossrefs

A355660 Numbers m such that the smallest number of pentagonal numbers (A000326) which sum to m is exactly 4.

Original entry on oeis.org

4, 8, 16, 19, 20, 26, 30, 33, 38, 42, 50, 54, 60, 65, 67, 77, 81, 84, 88, 90, 96, 99, 100, 101, 111, 112, 113, 120, 125, 131, 135, 138, 142, 154, 159, 160, 166, 170, 171, 183, 195, 204, 205, 207, 217, 224, 225, 226, 229, 230, 236, 240, 241, 243, 255, 265, 275, 277, 286, 306, 308, 345
Offset: 1

Views

Author

Bernard Schott, Jul 12 2022

Keywords

Comments

Richard Blecksmith & John Selfridge found 204 such integers among the first million, the largest of which is 33066. They believe that they have found them all (Richard K. Guy reference).
a(205) > 10^11, if it exists, from Giovanni Resta in A003679.

Examples

			4 = 1 + 1 + 1 + 1.
8 = 5 + 1 + 1 + 1.
16 = 5 + 5 + 5 + 1.
Also, it is not possible to get these terms when summing three or fewer pentagonal numbers.
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section D3, Figurate numbers, pp. 222-228.

Crossrefs

Equals A003679 \ A133929.

Programs

  • Mathematica
    nn = 100;
    pen = Table[n (3n - 1)/2, {n, 0, nn - 1}];
    lst = Range[pen[[-1]]];
    Do[n = pen[[i]]+pen[[j]]+pen[[k]]; If[n <= pen[[-1]], lst = DeleteCases[lst, n]], {i, 1, nn}, {j, i, nn}, {k, j, nn}];
    A003679 = lst;
    Complement[A003679, {9, 21, 31, 43, 55, 89}] (* Jean-François Alcover, Jul 13 2022, after T. D. Noe in A003679 *)

Formula

A100878(a(n)) = 4.

A355717 Smallest number of generalized pentagonal numbers which sum to n.

Original entry on oeis.org

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

Views

Author

Bernard Schott, Jul 15 2022

Keywords

Comments

From Euler's Pentagonal Number Theorem, every number is expressible as the sum of at most three generalized pentagonal numbers (A001318) (see Richard K. Guy reference).
Corresponding sums of only pentagonal numbers of positive rank are A100878(n). Those numbers are a subset of the generalized pentagonals so that a(n) <= A100878(n).
More specifically, by the definition given in the name, we understand the following: Given n >= 0 we seek a multiset S such that (1) S is a multiset of GPN = {0, 1, 2, 5, ...} = A001318; (2) Sum(S) = n; (3) if T is a multiset of GPN and Sum(T) = n then card(T) >= card(S). Additionally one might require that the set is not empty. If a multiset satisfies these three conditions, then a(n) = card(S). Note that no actual summation has to be performed to decide the value of a(n); only membership in GPN needs to be tested, as shown in the Maple and Python program. - Peter Luschny, Jul 18 2022

Examples

			Let GPN = {0, 1, 2, 5, ...} be the generalized pentagonal numbers.
a(0) = 0 since {} is a multiset of GPN, Sum {} = 0, and card({}) = 0.
a(1) = 1 since {1} is a multiset of GPN, Sum {1} = 1, and card({1}) = 1.
a(3) = 2 since {1, 2} is a multiset of GPN, Sum {1, 2} = 3, and card({1, 2}) = 2.
a(11) = 3 since {2, 2, 7} is a multiset of GPN, Sum {2, 2, 7} = 11, card({2, 2, 7}) = 3, and no other multiset S of GPN with Sum(S) = 11 has less members.
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section D3, Figurate numbers, pp. 222-228.

Crossrefs

Cf. A001318, A093519 (indices of 3's).
Cf. A100878.

Programs

  • Maple
    A355717_list := proc(upto) local P, Q, k, q, isgpn; P := []; Q := [0];
    isgpn := k -> ormap(n -> 0 = 8*k - (n + irem(n,2)) * (3*n + 2 - irem(n,2)), [$0..k]);
    for k from 1 to upto do
        q := 3;
        if isgpn(k) then
            P := [op(P), k]; q := 1;
            elif ormap(p -> member(k - p, P), P) then q := 2 fi:
            Q := [op(Q), q];
    od: Q end:
    print(A355717_list(100));  # Peter Luschny, Jul 18 2022
  • Python
    def A355717_list(ln: int) -> list[int]:
        P: list[int] = []
        Q: list[int] = [0]
        def is_gpn(k: int) -> bool:
            return any(8 * k == ((n + n % 2) * (3 * n + 2 - n % 2)) for n in range(k + 1))
        for k in range(1, ln):
            q = 3
            if is_gpn(k):
                P.append(k)
                q = 1
            elif any([(k - p) in P for p in P]):
                q = 2
            Q.append(q)
        return Q
    print(A355717_list(100))  # Peter Luschny, Jul 18 2022

Formula

a(n) <= 3.
a(A001318(n)) = 1.

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