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

A000404 Numbers that are the sum of 2 nonzero squares.

Original entry on oeis.org

2, 5, 8, 10, 13, 17, 18, 20, 25, 26, 29, 32, 34, 37, 40, 41, 45, 50, 52, 53, 58, 61, 65, 68, 72, 73, 74, 80, 82, 85, 89, 90, 97, 98, 100, 101, 104, 106, 109, 113, 116, 117, 122, 125, 128, 130, 136, 137, 145, 146, 148, 149, 153, 157, 160, 162, 164, 169, 170, 173, 178
Offset: 1

Views

Author

Keywords

Comments

From the formula it is easy to see that if k is in this sequence, then so are all odd powers of k. - T. D. Noe, Jan 13 2009
Also numbers whose cubes are the sum of two nonzero squares. - Joe Namnath and Lawrence Sze
A line perpendicular to y=mx has its first integral y-intercept at a^2+b^2. The remaining ones for that slope are multiples of that primitive value. - Larry J Zimmermann, Aug 19 2010
The primes in this sequence are sequence A002313.
Complement of A018825; A025426(a(n)) > 0; A063725(a(n)) > 0. - Reinhard Zumkeller, Aug 16 2011
If the two squares are not equal, then any power is still in the sequence: if k = x^2 + y^2 with x != y, then k^2 = (x^2-y^2)^2 + (2xy)^2 and k^3 = (x(x^2-3y^2))^2 + (y(3x^2-y^2))^2, etc. - Carmine Suriano, Jul 13 2012
There are never more than 3 consecutive terms that differ by 1. Triples of consecutive terms that differ by 1 occur infinitely many times, for example, 2(k^2 + k)^2, (k^2 - 1)^2 + (k^2 + 2 k)^2, and (k^2 + k - 1)^2 + (k^2 + k + 1)^2 for any integer k > 1. - Ivan Neretin, Mar 16 2017 [Corrected by Jerzy R Borysowicz, Apr 14 2017]
Number of terms less than 10^k, k=1,2,3,...: 3, 34, 308, 2690, 23873, 215907, 1984228, ... - Muniru A Asiru, Feb 01 2018
The squares in this sequence are the squares of the so-called hypotenuse numbers A009003. - M. F. Hasler, Jun 20 2025

Examples

			25 = 3^2 + 4^2, therefore 25 is a term. Note that also 25^3 = 15625 = 44^2 + 117^2, therefore 15625 is a term.
		

References

  • David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
  • GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 103.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 75, Theorem 4, with Theorem 2, p. 15.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, p. 219, th. 251, 252.
  • Ian Stewart, "Game, Set and Math", Chapter 8, 'Close Encounters of the Fermat Kind', Penguin Books, Ed. 1991, pp. 107-124.

Crossrefs

A001481 gives another version (allowing for zero squares).
Cf. A004431 (2 distinct squares), A063725 (number of representations), A024509 (numbers with multiplicity), A025284, A018825. Also A050803, A050801, A001105, A033431, A084888, A000578, A000290, A057961, A232499, A007692.
Cf. A003325 (analog for cubes), A003336 (analog for 4th powers).
Cf. A009003 (square roots of the squares in this sequence).
Column k=2 of A336725.

Programs

  • GAP
    P:=List([1..10^4],i->i^2);;
    A000404 := Set(Flat(List(P, i->List(P, j -> i+j)))); # Muniru A Asiru, Feb 01 2018
    
  • Haskell
    import Data.List (findIndices)
    a000404 n = a000404_list !! (n-1)
    a000404_list = findIndices (> 0) a025426_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Magma
    lst:=[]; for n in [1..178] do f:=Factorization(n); if IsSquare(n) then for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 1 then Append(~lst, n); break; end if; end for; else t:=0; for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 3 and d[2] mod 2 eq 1 then t:=1; break; end if; end for; if t eq 0 then Append(~lst, n); end if; end if; end for; lst; // Arkadiusz Wesolowski, Feb 16 2017
    
  • Maple
    nMax:=178: A:={}: for i to floor(sqrt(nMax)) do for j to floor(sqrt(nMax)) do if i^2+j^2 <= nMax then A := `union`(A, {i^2+j^2}) else  end if end do end do: A; # Emeric Deutsch, Jan 02 2017
  • Mathematica
    nMax=1000; n2=Floor[Sqrt[nMax-1]]; Union[Flatten[Table[a^2+b^2, {a,n2}, {b,a,Floor[Sqrt[nMax-a^2]]}]]]
    Select[Range@ 200, Length[PowersRepresentations[#, 2, 2] /. {0, } -> Nothing] > 0 &] (* _Michael De Vlieger, Mar 24 2016 *)
    Module[{upto=200},Select[Union[Total/@Tuples[Range[Sqrt[upto]]^2,2]],#<= upto&]] (* Harvey P. Dale, Sep 18 2021 *)
  • PARI
    is_A000404(n)= for( i=1,#n=factor(n)~%4, n[1,i]==3 && n[2,i]%2 && return); n && ( vecmin(n[1,])==1 || (n[1,1]==2 && n[2,1]%2)) \\ M. F. Hasler, Feb 07 2009
    
  • PARI
    list(lim)=my(v=List(),x2); lim\=1; for(x=1,sqrtint(lim-1), x2=x^2; for(y=1,sqrtint(lim-x2), listput(v,x2+y^2))); Set(v) \\ Charles R Greathouse IV, Apr 30 2016
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A000404_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            c = False
            for p in (f:=factorint(n)):
                if (q:= p & 3)==3 and f[p]&1:
                    break
                elif q == 1:
                    c = True
            else:
                if c or f.get(2,0)&1:
                    yield n
    A000404_list = list(islice(A000404_gen(),30)) # Chai Wah Wu, Jul 01 2022

Formula

Let k = 2^t * p_1^a_1 * p_2^a_2 * ... * p_r^a_r * q_1^b_1 * q_2^b_2 * ... * q_s^b_s with t >= 0, a_i >= 0 for i=1..r, where p_i == 1 (mod 4) for i=1..r and q_j == -1 (mod 4) for j=1..s. Then k is a term iff 1) b_j == 0 (mod 2) for j=1..s and 2) r > 0 or t == 1 (mod 2) (or both).
From Charles R Greathouse IV, Nov 18 2022: (Start)
a(n) ~ k*n*sqrt(log n), where k = 1.3085... = 1/A064533.
There are B(x) = (x/sqrt(log x)) * (K + B2/log x + O(1/log^2 x)) terms of this sequence up to x, where K = A064533 and B2 = A227158. (End)

Extensions

Edited by Ralf Stephan, Nov 15 2004
Typo in formula corrected by M. F. Hasler, Feb 07 2009
Erroneous Mathematica program fixed by T. D. Noe, Aug 07 2009
PARI code fixed for versions > 2.5 by M. F. Hasler, Jan 01 2013

A000337 a(n) = (n-1)*2^n + 1.

Original entry on oeis.org

0, 1, 5, 17, 49, 129, 321, 769, 1793, 4097, 9217, 20481, 45057, 98305, 212993, 458753, 983041, 2097153, 4456449, 9437185, 19922945, 41943041, 88080385, 184549377, 385875969, 805306369, 1677721601, 3489660929, 7247757313, 15032385537, 31138512897, 64424509441
Offset: 0

Views

Author

Keywords

Comments

a(n) also gives number of 0's in binary numbers 1 to 111..1 (n+1 bits). - Stephen G Penrice, Oct 01 2000
Numerator of m(n) = (m(n-1)+n)/2, m(0)=0. Denominator is A000079. - Reinhard Zumkeller, Feb 23 2002
a(n) is the number of directed column-convex polyominoes of area n+2 having along the lower contour exactly one vertical step that is followed by a horizontal step (a reentrant corner). - Emeric Deutsch, May 21 2003
a(n) is the number of bits in binary numbers from 1 to 111...1 (n bits). Partial sums of A001787. - Emeric Deutsch, May 24 2003
Genus of graph of n-cube = a(n-3) = 1+(n-4)*2^(n-3), n>1.
Sum of ordered partitions of n where each element is summed via T(e-1). See A066185 for more information. - Jon Perry, Dec 12 2003
a(n-2) is the number of Dyck n-paths with exactly one peak at height >= 3. For example, there are 5 such paths with n=4: UUUUDDDD, UUDUUDDD, UUUDDUDD, UDUUUDDD, UUUDDDUD. - David Callan, Mar 23 2004
Permutations in S_{n+2} avoiding 12-3 that contain the pattern 13-2 exactly once.
a(n) is prime for n = 2, 3, 7, 27, 51, 55, 81. a(n) is semiprime for n = 4, 5, 6, 8, 9, 10, 11, 13, 15, 19, 28, 32, 39, 57, 63, 66, 75, 97. - Jonathan Vos Post, Jul 18 2005
A member of the family of sequences defined by a(n) = Sum_{i=1..n} i*[c(1)*...*c(r)]^(i-1). This sequence has c(1)=2, A014915 has c(1)=3. - Ctibor O. Zizka, Feb 23 2008
Starting with 1 = row sums of A023758 as a triangle by rows: [1; 2,3; 4,6,7; 8,12,14,15; ...]. - Gary W. Adamson, Jul 18 2008
Equivalent formula given in Brehm: for each q >= 3 there exists a polyhedral map M_q of type {4, q} with [number of vertices] f_0 = 2^q and [genus] g = (2^(q-3))*(q-4) + 1 such that M_q and its dual have polyhedral embeddings in R^3 [McMullen et al.]. - Jonathan Vos Post, Jul 25 2009
Sums of rows of the triangle in A173787. - Reinhard Zumkeller, Feb 28 2010
This sequence is related to A000079 by a(n) = n*A000079(n)-Sum_{i=0..n-1} A000079(i). - Bruno Berselli, Mar 06 2012
(1 + 5*x + 17*x^2 + 49*x^3 + ...) = (1 + 2*x + 4*x^2 + 8*x^3 + ...) * (1 + 3*x + 7*x^2 + 15*x^3 + ...). - Gary W. Adamson, Mar 14 2012
The first barycentric coordinate of the centroid of Pascal triangles, assuming that numbers are weights, is A000295(n+1)/A000337(n), no matter what the triangle sides are. See attached figure. - César Eliud Lozada, Nov 14 2014
a(n) is the n-th number that is a sum of n positive n-th powers for n >= 1. a(4) = 49 = A003338(4). - Alois P. Heinz, Aug 01 2020
a(n) is the sum of the largest elements of all subsets of {1,2,..,n}. For example, a(3)=17; the subsets of {1,2,3} are {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}, and the sum of the largest elements is 17. - Enrique Navarrete, Aug 20 2020
a(n-1) is the sum of the second largest elements of the subsets of {1,2,..,n} that contain n. For example, for n = 4, a(3)=17; the subsets of {1,2,3,4} that contain 4 are {4}, {1,4}, {2,4}, {3,4}, {1,2,4}, {1,3,4}, {2,3,4}, {1,2,3,4}, and the sum of the second largest elements is 17. - Enrique Navarrete, Aug 24 2020
a(n-1) is also the sum of diameters of all subsets of {1,2,...,n} that contain n. For example, for n = 4, a(3)=17; the subsets of {1,2,3,4} that contain 4 are {4}, {1,4}, {2,4}, {3,4}, {1,2,4}, {1,3,4}, {2,3,4}, {1,2,3,4}; the diameters of these sets are 0,3,2,1,3,3,2,3 and the sum is 17. - Enrique Navarrete, Sep 07 2020
a(n-1) is also the number of additions required to compute the permanent of general n X n matrices using trellis methods (see Theorems 5 and 6, pp. 10-11 in Kiah et al.). - Stefano Spezia, Nov 02 2021

References

  • F. Harary, Topological concepts in graph theory, pp. 13-17 of F. Harary and L. Beineke, editors, A seminar on Graph Theory, Holt, Rinehart and Winston, New York, 1967.
  • V. G. Gutierrez and S. L. de Medrano, Surfaces as complete intersections, in Riemann and Klein Surfaces, Automorphisms, Symmetries and Moduli Spaces, edited by Milagros Izquierdo, S. Allen Broughton, Antonio F. Costa, Contemp. Math. vol. 629, 2014, pp. 171-.
  • F. Harary, Graph Theory. Addison-Wesley, Reading, MA, 1969, p. 119.
  • G. H. Hardy, A Theorem Concerning the Infinite Cardinal Numbers, Quart. J. Math., 35 (1904), p. 90 = Collected Papers of G. H. Hardy, Vol. VII, p. 430.
  • 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

a(n) = T(3, n), array T given by A048472. A036799/2.
Cf. A003338.
Main diagonal of A336725.

Programs

  • GAP
    List([0..30],n->(n-1)*2^n+1); # Muniru A Asiru, Oct 24 2018
  • Magma
    [(n-1)*2^n + 1: n in [0..40]]; // Vincenzo Librandi, Nov 21 2014
    
  • Maple
    A000337 := proc(n) 1+(n-1)*2^n ; end proc: # R. J. Mathar, Oct 10 2011
  • Mathematica
    Table[Sum[(-1)^(n - k) k (-1)^(n - k) Binomial[n + 1, k + 1], {k, 0, n}], {n, 0, 28}] (* Zerinvary Lajos, Jul 08 2009 *)
    Table[(n - 1) 2^n + 1, {n, 0, 40}] (* Harvey P. Dale, Jun 21 2011 *)
    LinearRecurrence[{5, -8, 4}, {0, 1, 5}, 40] (* Harvey P. Dale, Jun 21 2011 *)
    CoefficientList[Series[x / ((1 - x) (1 - 2 x)^2), {x, 0, 50}], x] (* Vincenzo Librandi, Nov 21 2014 *)
  • PARI
    a(n)=if(n<0,0,(n-1)*2^n+1)
    
  • Python
    a=lambda n:((n-1)<<(n))+1 # Indranil Ghosh, Jan 05 2017
    

Formula

Binomial transform of A004273. Binomial transform of A008574 if the leading zero is dropped.
G.f.: x/((1-x)*(1-2*x)^2). - Simon Plouffe in his 1992 dissertation
E.g.f.: exp(x) - exp(2*x)*(1-2*x). a(n) = 4*a(n-1) - 4*a(n-2)+1, n>0. Series reversion of g.f. A(x) is x*A034015(-x). - Michael Somos
Binomial transform of n/(n+1) is a(n)/(n+1). - Paul Barry, Aug 19 2005
a(n) = A119258(n+1,n-1) for n>0. - Reinhard Zumkeller, May 11 2006
Convolution of "Number of fixed points in all 231-avoiding involutions in S_n" (A059570) with "The odd numbers" (A005408), treating the result as if offset=0. - Graeme McRae, Jul 12 2006
a(n) = Sum_{k=1..n} k*2^(k-1), partial sums of A001787. - Zerinvary Lajos, Oct 19 2006
a(n) = 5*a(n-1) - 8*a(n-2) + 4*a(n-3), n > 2. - Harvey P. Dale, Jun 21 2011
a(n) = Sum_{k=1..n} Sum_{i=1..n} i * C(k,i). - Wesley Ivan Hurt, Sep 19 2017
a(n) = A000295(n+1)^2 - A000295(n)*A000295(n+2). - Gregory Gerard Wojnar, Oct 23 2018

A003350 Numbers that are the sum of 5 positive 5th powers.

Original entry on oeis.org

5, 36, 67, 98, 129, 160, 247, 278, 309, 340, 371, 489, 520, 551, 582, 731, 762, 793, 973, 1004, 1028, 1059, 1090, 1121, 1152, 1215, 1270, 1301, 1332, 1363, 1512, 1543, 1574, 1754, 1785, 1996, 2051, 2082, 2113, 2144, 2293, 2324, 2355, 2535, 2566, 2777, 3074, 3105, 3129
Offset: 1

Views

Author

Keywords

Examples

			From _David A. Corneth_, Aug 03 2020: (Start)
122490 is in the sequence as 122490 = 3^5 + 4^5 + 5^5 + 9^5 + 9^5.
251124 is in the sequence as 251124 = 1^5 + 3^5 + 4^5 + 4^5 + 12^5.
349858 is in the sequence as 349858 = 1^5 + 1^5 + 4^5 + 10^5 + 12^5. (End)
		

Crossrefs

Programs

  • Mathematica
    f[upto_]:=Module[{max=Floor[Power[upto, (5)^-1]],tp},tp=Union[ Total/@ (Tuples[ Range[max],{5}]^5)]; Select[tp,#<=upto&]]; f[2100]  (* Harvey P. Dale, Mar 22 2011 *)

A003362 Numbers that are the sum of 6 positive 6th powers.

Original entry on oeis.org

6, 69, 132, 195, 258, 321, 384, 734, 797, 860, 923, 986, 1049, 1462, 1525, 1588, 1651, 1714, 2190, 2253, 2316, 2379, 2918, 2981, 3044, 3646, 3709, 4101, 4164, 4227, 4290, 4353, 4374, 4416, 4829, 4892, 4955, 5018, 5081, 5557, 5620, 5683, 5746, 6285, 6348, 6411, 7013
Offset: 1

Views

Author

Keywords

Comments

This sequence has no sixth powers less than 1.5133*10^35. - J. Lowell, Jul 03 2021

Examples

			From _David A. Corneth_, Aug 03 2020: (Start)
448832 is in the sequence as 448832 = 2^6 + 6^6 + 6^6 + 6^6 + 6^6 + 8^6.
1000733 is in the sequence as 1000733 = 1^6 + 1^6 + 1^6 + 1^6 + 3^6 + 10^6.
1819677 is in the sequence as 1819677 = 1^6 + 1^6 + 3^6 + 3^6 + 6^6 + 11^6. (End)
		

Crossrefs

Cf. A001014 (sixth powers).
Column k=6 of A336725.

Programs

  • Mathematica
    Reap[For[n = 1, n <= 10000, n++, If[AnyTrue[PowersRepresentations[n, 6, 6], First[#] > 0&], Print[n]; Sow[n]]]][[2, 1]] (* Jean-François Alcover, Jul 18 2017 *)
    With[{nn=5},Select[Total/@Tuples[Range[nn]^6,6]//Union,#<=nn^6-5&]] (* Harvey P. Dale, Mar 27 2022 *)

A003374 Numbers that are the sum of 7 positive 7th powers.

Original entry on oeis.org

7, 134, 261, 388, 515, 642, 769, 896, 2193, 2320, 2447, 2574, 2701, 2828, 2955, 4379, 4506, 4633, 4760, 4887, 5014, 6565, 6692, 6819, 6946, 7073, 8751, 8878, 9005, 9132, 10937, 11064, 11191, 13123, 13250, 15309, 16390, 16517, 16644, 16771, 16898, 17025, 17152, 18576
Offset: 1

Views

Author

Keywords

Examples

			From _David A. Corneth_, Aug 03 2020: (Start)
2200409 is in the sequence as 2200409 = 3^7 + 3^7 + 3^7 + 3^7 + 4^7 + 5^7 + 8^7.
4122089 is in the sequence as 4122089 = 3^7 + 3^7 + 7^7 + 7^7 + 7^7 + 7^7 + 7^7.
6356992 is in the sequence as 6356992 = 4^7 + 4^7 + 4^7 + 4^7 + 8^7 + 8^7 + 8^7. (End)
		

Crossrefs

Cf. A001015 (seventh powers).
Column k=7 of A336725.

Programs

  • Mathematica
    M = 21027478; m = M^(1/7) // Ceiling; Reap[
    For[a = 1, a <= m, a++, For[b = a, b <= m, b++, For[c = b, c <= m, c++,
    For[d = c, d <= m, d++, For[e = d, e <= m, e++, For[f = e, f <= m, f++,
    For[g = f, g <= m, g++,
    s = a^7 + b^7 + c^7 + d^7 + e^7 + f^7 + g^7;
    If[s <= M, Sow[s]]]]]]]]]][[2, 1]] // Union (* Jean-François Alcover, Dec 01 2020 *)

A003398 Numbers that are the sum of 9 positive 9th powers.

Original entry on oeis.org

9, 520, 1031, 1542, 2053, 2564, 3075, 3586, 4097, 4608, 19691, 20202, 20713, 21224, 21735, 22246, 22757, 23268, 23779, 39373, 39884, 40395, 40906, 41417, 41928, 42439, 42950, 59055, 59566, 60077, 60588, 61099, 61610, 62121, 78737, 79248, 79759, 80270, 80781, 81292, 98419
Offset: 1

Views

Author

Keywords

Examples

			From _David A. Corneth_, Aug 02 2020: (Start)
26015282 is in the sequence as 26015282 = 1^9 + 1^9 + 1^9 + 2^9 + 5^9 + 5^9 + 5^9 + 6^9 + 6^9.
56248367 is in the sequence as 56248367 = 2^9 + 5^9 + 5^9 + 5^9 + 6^9 + 6^9 + 6^9 + 6^9 + 6^9.
84613980 is in the sequence as 84613980 = 1^9 + 1^9 + 1^9 + 1^9 + 2^9 + 5^9 + 5^9 + 7^9 + 7^9. (End)
		

Crossrefs

Cf. A001017 (9th powers).
Column k=9 of A336725.

Programs

  • Mathematica
    M = 10^5; m = M^(1/9) // Ceiling; Reap[
    For[a = 1, a <= m, a++,
    For[b = a, b <= m, b++, For[c = b, c <= m, c++, For[d = c, d <= m, d++,
    For[e = d, e <= m, e++, For[f = e, f <= m, f++, For[g = f, g <= m, g++,
    For[h = g, h <= m, h++, For[i = h, i <= m, i++,
    s = a^9 + b^9 + c^9 + d^9 + e^9 + f^9 + g^9 + h^9 + i^9;
    If[s <= M, Sow[s]]]]]]]]]]]][[2, 1]] // Union (* Jean-François Alcover, Dec 01 2020 *)

A004810 Numbers that are the sum of 10 positive 10th powers.

Original entry on oeis.org

10, 1033, 2056, 3079, 4102, 5125, 6148, 7171, 8194, 9217, 10240, 59058, 60081, 61104, 62127, 63150, 64173, 65196, 66219, 67242, 68265, 118106, 119129, 120152, 121175, 122198, 123221, 124244, 125267, 126290, 177154, 178177, 179200, 180223, 181246, 182269, 183292, 184315
Offset: 1

Views

Author

Keywords

Examples

			From _David A. Corneth_, Aug 03 2020: (Start)
72332028 is in the sequence as 72332028 = 1^10 + 1^10 + 1^10 + 2^10 + 2^10 + 2^10 + 4^10 + 4^10 + 5^10 + 6^10.
243962883 is in the sequence as 243962883 = 1^10 + 1^10 + 1^10 + 2^10 + 4^10 + 4^10 + 6^10 + 6^10 + 6^10 + 6^10.
312998872 is in the sequence as 312998872 = 1^10 + 2^10 + 3^10 + 3^10 + 3^10 + 4^10 + 5^10 + 5^10 + 5^10 + 7^10. (End)
		

Crossrefs

Cf. A008454.
Column k=10 of A336725.

Programs

  • Mathematica
    M = 1413602992; m = M^(1/10) // Ceiling; Reap[
    For[a = 1, a <= m, a++, For[b = a, b <= m, b++, For[c = b, c <= m, c++,
    For[d = c, d <= m, d++, For[e = d, e <= m, e++, For[f = e, f <= m, f++,
    For[g = f, g <= m, g++, For[h = g, h <= m, h++, For[i = h, i <= m, i++,
    For[j = i, j <= m, j++,
    s = a^10 + b^10 + c^10 + d^10 + e^10 + f^10 + g^10 + h^10 + i^10 + j^10;
    If[s <= M, Sow[s]]]]]]]]]]]]][[2, 1]] // Union (* Jean-François Alcover, Dec 01 2020 *)

A336820 A(n,k) is the n-th number that is a sum of at most k positive k-th powers; square array A(n,k), n>=1, k>=1, read by antidiagonals.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 4, 4, 0, 1, 2, 3, 5, 5, 0, 1, 2, 3, 8, 8, 6, 0, 1, 2, 3, 4, 9, 9, 7, 0, 1, 2, 3, 4, 16, 10, 10, 8, 0, 1, 2, 3, 4, 5, 17, 16, 13, 9, 0, 1, 2, 3, 4, 5, 32, 18, 17, 16, 10, 0, 1, 2, 3, 4, 5, 6, 33, 19, 24, 17, 11, 0, 1, 2, 3, 4, 5, 6, 64, 34, 32, 27, 18, 12
Offset: 1

Views

Author

Alois P. Heinz, Aug 04 2020

Keywords

Examples

			Square array A(n,k) begins:
   0,  0,  0,  0,  0,  0,   0,   0,   0,  0,  0, ...
   1,  1,  1,  1,  1,  1,   1,   1,   1,  1,  1, ...
   2,  2,  2,  2,  2,  2,   2,   2,   2,  2,  2, ...
   3,  4,  3,  3,  3,  3,   3,   3,   3,  3,  3, ...
   4,  5,  8,  4,  4,  4,   4,   4,   4,  4,  4, ...
   5,  8,  9, 16,  5,  5,   5,   5,   5,  5,  5, ...
   6,  9, 10, 17, 32,  6,   6,   6,   6,  6,  6, ...
   7, 10, 16, 18, 33, 64,   7,   7,   7,  7,  7, ...
   8, 13, 17, 19, 34, 65, 128,   8,   8,  8,  8, ...
   9, 16, 24, 32, 35, 66, 129, 256,   9,  9,  9, ...
  10, 17, 27, 33, 36, 67, 130, 257, 512, 10, 10, ...
		

Crossrefs

A(n+j,n) for j=0-3 give: A001477(n-1), A000027, A000079, A000051.
Cf. A336725.

Programs

  • Maple
    A:= proc() local l, w, A; l, w, A:= proc() [] end, proc() [] end,
          proc(n, k) option remember; local b; b:=
            proc(x, y) option remember; `if`(x<0 or y<1, {},
              {0, b(x, y-1)[], map(t-> t+l(k)[y], b(x-1, y))[]})
            end;
            while nops(w(k)) < n do forget(b);
              l(k):= [l(k)[], (nops(l(k))+1)^k];
              w(k):= sort([select(h-> h
    				
  • Mathematica
    b[n_, k_, i_, t_] := b[n, k, i, t] = n == 0 || i > 0 && t > 0 && (b[n, k, i - 1, t] || i^k <= n && b[n - i^k, k, i, t - 1]);
    A[n_, k_] := A[n, k] = Module[{m}, For[m = 1 + If[n == 1, -1, A[n - 1, k]], !b[m, k, m^(1/k) // Floor, k], m++]; m];
    Table[A[n, 1+d-n], {d, 1, 14}, {n, 1, d}] // Flatten (* Jean-François Alcover, Dec 03 2020, using Alois P. Heinz's code for columns *)

Formula

A(n,k) = n-1 for n <= k+1.

A145071 Partial sums of A000051, starting at n=1.

Original entry on oeis.org

3, 8, 17, 34, 67, 132, 261, 518, 1031, 2056, 4105, 8202, 16395, 32780, 65549, 131086, 262159, 524304, 1048593, 2097170, 4194323, 8388628, 16777237, 33554454, 67108887, 134217752, 268435481, 536870938, 1073741851, 2147483676, 4294967325, 8589934622, 17179869215
Offset: 1

Views

Author

Keywords

Comments

The third number that is a sum of n positive n-th powers. - Alois P. Heinz, Aug 02 2020

Examples

			a(2) = a(1) + 2^2 + 1 = 3 + 4 + 1 = 8; a(3) = a(2) + 2^3 + 1 = 8 + 8 + 1 = 17.
		

Crossrefs

Cf. A000051 (2^n + 1), A000225 (2^n - 1), A000295 (Eulerian numbers).
Column k = 1 of triangle A308737.
Row n=3 of A336725.

Programs

  • ARIBAS
    a:=0; for n:=1 to 30 do a:=a+2**n+1; write(a,","); end;
    
  • Haskell
    a145071 n = 2 ^ (n + 1) + n - 2
    a145071_list = scanl1 (+) $ tail a000051_list
    -- Reinhard Zumkeller, Nov 16 2013
  • Mathematica
    lst={};s=0;Do[s+=2^n+1;AppendTo[lst,s],{n,5!}];lst
    Accumulate[2^Range[30]+1] (* Harvey P. Dale, Feb 19 2023 *)

Formula

a(1) = 3; a(n) = a(n-1) + 2^n + 1 for n > 1.
a(n) = 2^(n+1) + n - 2. - Franklin T. Adams-Watters, Jul 06 2009
G.f.: x*(3-4*x)/((1-x)^2*(1-2*x)). - Colin Barker, Jan 11 2012
a(n) = A127330(n,n) = A052944(n-1) + 2. - Reinhard Zumkeller, Nov 16 2013
From Elmo R. Oliveira, Apr 01 2025: (Start)
E.g.f.: exp(x)*(x - 2 + 2*exp(x)).
a(n) = 4*a(n-1) - 5*a(n-2) + 2*a(n-3) for n > 3. (End)

Extensions

Edited by Klaus Brockhaus, Oct 14 2008
Showing 1-9 of 9 results.