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 16 results. Next

A175270 Numbers k such that the least number of squares that add up to k equals the least number of triangular numbers that add up to k. Equivalently, A002828(k) = A061336(k).

Original entry on oeis.org

0, 1, 2, 13, 14, 18, 19, 20, 29, 33, 34, 35, 36, 37, 44, 54, 58, 59, 61, 62, 65, 72, 73, 75, 77, 86, 90, 96, 97, 101, 106, 107, 118, 129, 130, 131, 134, 137, 138, 140, 146, 147, 148, 152, 155, 157, 158, 160, 161, 164, 166, 176, 179, 181, 184, 187, 193, 195, 200
Offset: 1

Views

Author

Ctibor O. Zizka, Mar 19 2010

Keywords

Crossrefs

Programs

  • PARI
    is2s(n)=my(f=factor(n>>valuation(n, 2))); for(i=1, #f~, if(bitand(f[i, 2], 1) && bitand(f[i, 1], 3)==3, return(0))); 1
    is2t(n)=my(m9=n%9,f); if(m9==5 || m9==8, return(0)); is2s(4*n+1)
    is(n)=my(o2=valuation(n, 2),f); if(n==0, return(1)); if(bitand(o2, 1)==0 && bitand(n>>o2, 7)==7, return(0)); if(issquare(n), return(ispolygonal(n,3))); if(ispolygonal(n,3), return(0)); is2t(n)==is2s(n) \\ Charles R Greathouse IV, Mar 17 2022

Extensions

Data corrected and extended by Mohammed Yaseen, Mar 17 2022

A104246 Minimal number of tetrahedral numbers (A000292(k) = k(k+1)(k+2)/6) needed to sum to n.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Feb 26 2005

Keywords

Comments

According to Dickson, Pollock conjectures that a(n) <= 5 for all n. Watson shows that a(n) <= 8 for all n, and Salzer and Levine show that a(n) <= 5 for n <= 452479659. - N. J. A. Sloane, Jul 15 2011
Possible correction of the first comment by Sloane 2011: it appears to me from the linked reference by Salzer and Levine 1968 that 452479659 is instead the upper limit for sums of five Qx = Tx + x, where Tx are the tetrahedral numbers we want. They also mention an upper limit for sums of five Tx, which is: a(n) <= 5 for n <= 276976383. - Ewoud Dronkert, May 30 2024
If we use the greedy algorithm for this, we get A281367. - N. J. A. Sloane, Jan 30 2017
Could be extended with a(0) = 0, in analogy to A061336. Kim (2003, first row of table "d = 3" on p. 73) gives max {a(n)} = 5 as a "numerical result", but the value has no "* denoting exact values" (see Remark at end of paper), which means this could be incorrect. - M. F. Hasler, Mar 06 2017, edited Sep 22 2022

References

  • Dickson, L. E., History of the Theory of Numbers, Vol. 2: Diophantine Analysis. New York: Dover, 1952, see p. 13.

Crossrefs

Cf. A000292 (tetrahedral numbers, indices of 1s), A102795 (indices of 2s), A102796 (indices of 3s), A102797 (indices of 4s), A000797 (numbers that need 5 tetrahedral numbers).
See also A102798-A102806, A102855-A102858, A193101, A193105, A281367 (the "triangular nachos" numbers).
Cf. A061336 (analog for triangular numbers).

Programs

  • Maple
    tet:=[seq((n^3-n)/6,n=1..20)];
    LAGRANGE(tet,8, 120); # the LAGRANGE transform of a sequence is defined in A193101. - N. J. A. Sloane, Jul 15 2011
    # alternative
    N := 10000:
    L := [seq(0,i=1..N)] :
    # put 1's where tetrahedral numbers reside
    for i from 1 to N do
        Aj := A000292(i) ;
        if Aj <= N then
            L := subsop(Aj=1,L) ;
        end if;
    end do:
    for a from 1 do
        # select positions of a's, skip forward by all available Aj and
        # if that addresses a not-yet-set position in the array put a+1 there.
        for i from 1 to N do
            if op(i,L) =a then
                for j from 1 do
                    Aj := A000292(j) ;
                    if i+Aj <=N and op(i+Aj,L) = 0 then
                        L := subsop(i+Aj=a+1,L) ;
                    end if;
                    if i +Aj > N then
                        break ;
                    end if;
                end do:
            end if;
        end do:
        # if all L[] are non-zero, terminate the loop
        allset := true;
        for i from 1 to N do
            if op(i,L) = 0 then
                allset := false ;
                break ;
            end if;
        end do:
        if allset then
            break ;
        end if;
    end do:
    seq( L[i],i=1..N) ; # R. J. Mathar, Jun 06 2025
  • PARI
    \\ available on request. - M. F. Hasler, Mar 06 2017
    
  • PARI
    seq(N) = {
      my(a = vector(N, k, 8), T = k->(k*(k+1)*(k+2))\6);
      for (n = 1, N,
        my (k1 = sqrtnint((6*n)\8, 3), k2 = sqrtnint(6*n, 3));
        while(n < T(k2), k2--); if (n == T(k2), a[n] = 1; next());
        for (k = k1, k2, a[n] = min(a[n], a[n - T(k)] + 1))); a;
    };
    seq(102)  \\ Gheorghe Coserea, Mar 14 2017

Extensions

Edited by N. J. A. Sloane, Jul 15 2011
Edited by M. F. Hasler, Mar 06 2017

A051533 Numbers that are the sum of two positive triangular numbers.

Original entry on oeis.org

2, 4, 6, 7, 9, 11, 12, 13, 16, 18, 20, 21, 22, 24, 25, 27, 29, 30, 31, 34, 36, 37, 38, 39, 42, 43, 46, 48, 49, 51, 55, 56, 57, 58, 60, 61, 64, 65, 66, 67, 69, 70, 72, 73, 76, 79, 81, 83, 84, 87, 88, 90, 91, 92, 93, 94, 97, 99, 100, 101, 102, 106, 108
Offset: 1

Views

Author

Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de)

Keywords

Comments

Numbers n such that 8n+2 is in A085989. - Robert Israel, Mar 06 2017

Examples

			666 is in the sequence because we can write 666 = 435 + 231 = binomial(22,2) + binomial(30,2).
		

Crossrefs

Cf. A000217, A020756 (sums of two triangular numbers), A001481 (sums of two squares), A007294, A051611 (complement).
Cf. A061336: minimal number of triangular numbers that sum up to n.
Cf. A085989.

Programs

  • Haskell
    a051533 n = a051533_list !! (n-1)
    a051533_list = filter ((> 0) . a053603) [1..]
    -- Reinhard Zumkeller, Jun 28 2013
    
  • Maple
    isA051533 := proc(n)
        local a,ta;
        for a from 1 do
            ta := A000217(a) ;
            if 2*ta > n then
                return false;
            end if;
            if isA000217(n-ta) then
                return true;
            end if;
        end do:
    end proc:
    for n from 1 to 200 do
        if isA051533(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Dec 16 2015
  • Mathematica
    f[k_] := If[!
       Head[Reduce[m (m + 1) + n (n + 1) == 2 k && 0 < m && 0 < n, {m, n},
           Integers]] === Symbol, k, 0]; DeleteCases[Table[f[k], {k, 1, 108}], 0] (* Ant King, Nov 22 2010 *)
    nn=50; tri=Table[n(n+1)/2, {n,nn}]; Select[Union[Flatten[Table[tri[[i]]+tri[[j]], {i,nn}, {j,i,nn}]]], #<=tri[[-1]] &]
    With[{nn=70},Take[Union[Total/@Tuples[Accumulate[Range[nn]],2]],nn]] (* Harvey P. Dale, Jul 16 2015 *)
  • PARI
    is(n)=for(k=ceil((sqrt(4*n+1)-1)/2),(sqrt(8*n-7)-1)\2, if(ispolygonal(n-k*(k+1)/2, 3), return(1))); 0 \\ Charles R Greathouse IV, Jun 09 2015

Formula

A053603(a(n)) > 0. - Reinhard Zumkeller, Jun 28 2013
A061336(a(n)) = 2. - M. F. Hasler, Mar 06 2017

A020757 Numbers that are not the sum of two triangular numbers.

Original entry on oeis.org

5, 8, 14, 17, 19, 23, 26, 32, 33, 35, 40, 41, 44, 47, 50, 52, 53, 54, 59, 62, 63, 68, 71, 74, 75, 77, 80, 82, 85, 86, 89, 95, 96, 98, 103, 104, 107, 109, 113, 116, 117, 118, 122, 124, 125, 128, 129, 131, 134, 138, 140, 143, 145, 147, 149, 152, 155, 158, 161, 162, 166, 167
Offset: 1

Views

Author

Keywords

Comments

A052343(a(n)) = 0. - Reinhard Zumkeller, May 15 2006
Numbers of the form (p^(2k+1)s-1)/4, where p is a prime number of the form 4n+3, and s is a number of the form 4m+3 and prime to p, are not expressible as the sum of two triangular numbers. See Satyanarayana (1961), Theorem 2. - Hans J. H. Tuenter, Oct 11 2009
An integer n is in this sequence if and only if at least one 4k+3 prime factor in the canonical form of 4n+1 occurs with an odd exponent. - Ant King, Dec 02 2010
A nonnegative integer n is in this sequence if and only if A000729(n) = 0. - Michael Somos, Feb 13 2011
4*a(n) + 1 are terms of A022544. - XU Pingya, Aug 05 2018 [Actually, k is here if and only if 4*k + 1 is in A022544. - Jianing Song, Feb 09 2021]
Integers m such that the smallest number of triangular numbers which sum to m is 3, hence A061336(a(n)) = 3. - Bernard Schott, Jul 21 2022

Examples

			3 = 0 + 3 and 7 = 1 + 6 are not terms, but 8 = 1 + 1 + 6 is a term.
		

Crossrefs

Complement of A020756.
Numbers k such that the coefficient of x^k in the expansion of Product_{j>=1} (1 - x^j)^m is zero: A090864 (m=1), A213250 (m=2), A014132 (m=3), A302056 (m=4), A302057 (m=5), this sequence (m=6), A322430 (m=8), A322431 (m=10), A322432 (m=14), A322043 (m=15), A322433 (m=26).

Programs

  • Haskell
    a020757 n = a020757_list !! (n-1)
    a020757_list = filter ((== 0) . a052343) [0..]
    -- Reinhard Zumkeller, Jul 25 2014
    
  • Mathematica
    data = Reduce[m (m + 1) + n (n + 1) == 2 # && 0 <= m && 0 <= n, {m, n}, Integers] & /@ Range[167]; Position[data, False] // Flatten  (* Ant King, Dec 05 2010 *)
    t = Array[PolygonalNumber, 18, 0]; Complement[Range@ 169, Flatten[ Outer[ Plus, t, t]]] (* Robert G. Wilson v, Aug 07 2024 *)
  • PARI
    is(n)=my(m9=n%9,f); if(m9==5 || m9==8, return(1)); f=factor(4*n+1); for(i=1,#f~, if(f[i,1]%4==3 && f[i,2]%2, return(1))); 0 \\ Charles R Greathouse IV, Mar 17 2022

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

A234533 Smallest number of hex numbers summing to n.

Original entry on oeis.org

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

Views

Author

Allan C. Wechsler, Dec 27 2013

Keywords

Comments

This sequence is to A003215 as A002828 is to A000290, and as A061336 is to A000217.

Examples

			a(21) = 3, because 21 = 19 + 1 + 1 = 7 + 7 + 7, so there are two ways to express 21 as the sum of 3 hex numbers, but no way to express 21 as the sum of 2 hex numbers.
		

Extensions

a(27)-a(87) from Lars Blomberg, Jan 07 2014

A258257 The number of representations of n as a minimal number of triangular numbers, A000217(n).

Original entry on oeis.org

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

Views

Author

Martin Renner, May 24 2015

Keywords

Examples

			a(5) = 1 since 5 = 1 + 1 + 3 is the only representation as a minimal number of three triangular numbers.
a(16) = 2 since 16 = 1 + 15 = 6 + 10 has two representations as a minimal number of two triangular numbers.
		

Crossrefs

Programs

  • Mathematica
    t[n_] := n (n + 1)/2; a[n_] := Block[{k = 1, t, tt = t /@ Range[ Sqrt[2*n]]}, While[{} == (r = IntegerPartitions[n, {k}, tt]), k++]; Length@r]; Array[a, 100] (* Giovanni Resta, Jun 09 2015 *)

A283365 Minimal number of numbers in A000332 = { C(k,4); k=1,2,3,... } whose sum equals n.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Mar 06 2017

Keywords

Comments

Analog, for A000332 = {C(n,4)}, of A061336 (for triangular numbers A000217) and A104246 (for tetrahedral numbers A000292).

Crossrefs

Cf. A000332 = {C(n,4)}; A061336 (analog for triangular numbers A000217), A104246 (analog for tetrahedral numbers A000292).

Programs

  • PARI
    {a(n,k=4,M=9e9,N=n) = (n <= k || M <= k+1) && return(n); for(m=k,M,binomial(m,k)>n && (M=m) && break); M-- <= k && return(n); my(b=binomial(M,k),c=binomial(M-1,k),NN); forstep( nn=n\b,0,-1, if(N>NN=nn+g(n-nn*b,k,M,N,d),N=NN); n-(nn-1)*b >= (N-nn+1)*c && break); N}

Formula

a(n) <= 8 = a(64) for all n, according to Kim (2003, first row of table "d = 4", p. 74), but this "numerical result" has no "* denoting exact values" (see Remark at end of paper), so it could be incorrect. [Disclaimer added by M. F. Hasler, Sep 22 2022]

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

A338482 Least number of centered triangular numbers that sum to n.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Oct 29 2020

Keywords

Comments

It appears that a(n) = 3 for n == 0 (mod 3), 1 <= a(n) <= 4 for n == 1 (mod 3), and 2 <= a(n) <= 5 for n == 2 (mod 3). - Robert Israel, Nov 13 2020

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; local r,i;
        r:= sqrt(24*n-15)/6+1/2;
        if r::integer then return 1 fi;
        1+min(seq(procname(n-(3*i*(i-1)/2+1)),i=1..floor(r)))
    end proc:
    map(f, [$1..200]); # Robert Israel, Nov 13 2020
  • Mathematica
    f[n_] := f[n] = Module[{r}, r = Sqrt[24n-15]/6+1/2; If[IntegerQ[r], Return[1]]; 1+Min[Table[f[n-(3i*(i-1)/2+1)], {i, 1, Floor[r]}]]];
    Map[f, Range[200]] (* Jean-François Alcover, Sep 16 2022, after Robert Israel *)
Showing 1-10 of 16 results. Next