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

A256624 a(n) = 2 * A153182(n) - A005875(n).

Original entry on oeis.org

1, -2, -4, -8, -10, -8, -8, -16, -20, -10, -8, -24, -24, -8, -16, -32, -26, -16, -12, -24, -40, -16, -8, -48, -40, -10, -24, -32, -32, -24, -16, -48, -52, -16, -16, -48, -50, -8, -24, -64, -40, -32, -16, -24, -72, -24, -16, -80, -56, -18, -28, -48, -40, -24
Offset: 0

Views

Author

Michael Somos, Jul 11 2015

Keywords

Examples

			G.f. = 1 - 2*x - 4*x^2 - 8*x^3 - 10*x^4 - 8*x^5 - 8*x^6 - 16*x^7 - 20*x^8 + ...
		

Crossrefs

Programs

  • Mathematica
    a[ n_] := If[ n < 0, 0, SeriesCoefficient[ (1 + 8 Sum[ (-1)^ k x^(k^2 + k) / (1 + (-x)^k)^2, {k, (Sqrt[4 n + 1] - 1)/2}]) / EllipticTheta[ 3, 0, x], {x, 0, n}]]; Table[a[n], {n, 0, 50}]
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( (1 + 8 * sum(k=1, (sqrtint(4*n + 1)-1)\2, (-1)^k * x^(k^2 + k) / (1 + (-x)^k)^2 , A)) / (1 + 2 * sum(k=1, sqrtint(n), x^k^2, A)), n))};

Formula

G.f.: (1 + 8 * Sum_{k > 0} (-1)^k * x^(k^2 + k) / (1 + (-x)^k)^2) / (1 + 2 * Sum_{k > 0} x^k^2).
a(n) = (-1)^n * A153181(n). - Michael Somos, Jul 12 2015

A138202 a(n) = A005875(n)^2.

Original entry on oeis.org

1, 36, 144, 64, 36, 576, 576, 0, 144, 900, 576, 576, 64, 576, 2304, 0, 36, 2304, 1296, 576, 576, 2304, 576, 0, 576, 900, 5184, 1024, 0, 5184, 2304, 0, 144, 2304, 2304, 2304, 900, 576, 5184, 0, 576, 9216, 2304, 576, 576, 5184, 2304, 0, 64, 2916, 7056, 2304, 576, 5184
Offset: 0

Views

Author

N. J. A. Sloane, Mar 04 2010

Keywords

Programs

  • Mathematica
    SquaresR[3,#]^2 &/@Range[0,53] (* Ant King, Mar 27 2013 *)

A085120 a(n) = Sum_{m=1..24} (25-m)^n*A005875(m).

Original entry on oeis.org

484, 5200, 74248, 1231168, 22274392, 426121840, 8473865608, 173384503648, 3626078527672, 77156534226640, 1664879923268968, 36341339939604928, 800962970101817752, 17798446869494190640, 398294702872579430728, 8967482707817471999008, 202975553115995639744632
Offset: 0

Views

Author

N. J. A. Sloane, Apr 25 2004

Keywords

A000378 Sums of three squares: numbers of the form x^2 + y^2 + z^2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 61, 62, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83
Offset: 1

Views

Author

Keywords

Comments

An equivalent definition: numbers of the form x^2 + y^2 + z^2 with x,y,z >= 0.
Bourgain studies "the spatial distribution of the representation of a large integer as a sum of three squares, on the small and critical scale as well as their electrostatic energy. The main results announced give strong evidence to the thesis that the solutions behave randomly. This is in sharp contrast to what happens with sums of two or four or more square." Sums of two nonzero squares are A000404. - Jonathan Vos Post, Apr 03 2012
The multiplicities for a(n) (if 0 <= x <= y <= z) are given as A000164(a(n)), n >= 1. Compare with A005875(a(n)) for integer x, y and z, and order taken into account. - Wolfdieter Lang, Apr 08 2013
a(n)^k is a member of this sequence for any k > 1. - Boris Putievskiy, May 05 2013
The selection rule for the planes with Miller indices (hkl) to undergo X-ray diffraction in a simple cubic lattice is h^2+k^2+l^2 = N where N is a term of this sequence. See A004014 for f.c.c. lattice. - Mohammed Yaseen, Nov 06 2022

Examples

			a(1) = 0 = 0^2 + 0^2 + 0^2. A005875(0) = 1 = A000164(0).
a(9) = 9 = 0^2 + 0^2 + 3^2 =  1^2 +  2^2 + 2^2. A000164(9) = 2. A000164(9) = 30 = 2*3 + 8*3 (counting signs and order). - _Wolfdieter Lang_, Apr 08 2013
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 37.
  • R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section C20.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 311.

Crossrefs

Union of A000290, A000404 and A000408 (common elements).
Union of A000290, A000415 and A000419 (disjunct sets).
Complement of A004215.
Cf. A005875 (number of representations if x, y and z are integers).

Programs

  • Maple
    isA000378 := proc(n) # return true or false depending on n being in the list
        local x,y ;
        for x from 0 do
            if 3*x^2 > n then
                return false;
            end if;
            for y from x do
                if x^2+2*y^2 > n then
                    break;
                else
                    if issqr(n-x^2-y^2) then
                        return true;
                    end if;
                end if;
            end do:
        end do:
    end proc:
    A000378 := proc(n) # generate A000378(n)
        option remember;
        local a;
        if n = 1 then
            0;
        else
            for a from procname(n-1)+1 do
                if isA000378(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A000378(n),n=1..100) ; # R. J. Mathar, Sep 09 2015
  • Mathematica
    okQ[n_] := If[EvenQ[k = IntegerExponent[n, 2]], m = n/2^k; Mod[m, 8] != 7, True]; Select[Range[0, 100], okQ] (* Jean-François Alcover, Feb 08 2016, adapted from PARI *)
  • PARI
    isA000378(n)=my(k=valuation(n, 2)); if(k%2==0, n>>=k; n%8!=7, 1)
    
  • PARI
    list(lim)=my(v=List(),k,t); for(x=0,sqrtint(lim\=1), for(y=0, min(sqrtint(lim-x^2),x), k=x^2+y^2; for(z=0,min(sqrtint(lim-k), y), listput(v,k+z^2)))); Set(v) \\ Charles R Greathouse IV, Sep 14 2015
    
  • Python
    def valuation(n, b):
        v = 0
        while n > 1 and n%b == 0: n //= b; v += 1
        return v
    def ok(n): return n//4**valuation(n, 4)%8 != 7
    print(list(filter(ok, range(84)))) # Michael S. Branicky, Jul 15 2021
    
  • Python
    from itertools import count, islice
    def A000378_gen(): # generator of terms
        return filter(lambda n:n>>2*(bin(n)[:1:-1].index('1')//2) & 7 < 7, count(1))
    A000378_list = list(islice(A000378_gen(),30)) # Chai Wah Wu, Jun 27 2022
    
  • Python
    def A000378(n):
        def f(x): return n-1+sum(((x>>(i<<1))-7>>3)+1 for i in range(x.bit_length()>>1))
        m, k = n-1, f(n-1)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Feb 14 2025

Formula

Legendre: a nonnegative integer is a sum of three squares iff it is not of the form 4^k m with m == 7 (mod 8).
n^(2k+1) is in the sequence iff n is in the sequence. - Ray Chandler, Feb 03 2009
Complement of A004215; complement of A000302(i)*A004771(j), i,j>=0. - Boris Putievskiy, May 05 2013
a(n) = 6n/5 + O(log n). - Charles R Greathouse IV, Mar 14 2014

Extensions

More terms from Ray Chandler, Sep 05 2004

A008443 Number of ordered ways of writing n as the sum of 3 triangular numbers.

Original entry on oeis.org

1, 3, 3, 4, 6, 3, 6, 9, 3, 7, 9, 6, 9, 9, 6, 6, 15, 9, 7, 12, 3, 15, 15, 6, 12, 12, 9, 12, 15, 6, 13, 21, 12, 6, 15, 9, 12, 24, 9, 18, 12, 9, 18, 15, 12, 13, 24, 9, 15, 24, 6, 18, 27, 6, 12, 15, 18, 24, 21, 15, 12, 27, 9, 13, 18, 15, 27, 27, 9, 12, 27, 15, 24, 21, 12, 15, 30, 15, 12
Offset: 0

Views

Author

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: EYPHEKA! num = DELTA + DELTA + DELTA. See also Gauss, DA, art. 293.
Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
Andrews (2016), Theorem 2, shows that A008443(n) = A290735(n) + A290737(n) + A290739(n). = N. J. A. Sloane, Aug 10 2017

Examples

			5 can be written as 3+1+1, 1+3+1, 1+1+3, so a(5) = 3.
G.f. = 1 + 3*x + 3*x^2 + 4*x^3 + 6*x^4 + 3*x^5 + 6*x^6 + 9*x^7 + 3*x^8 + ...
G.f. = q^3 + 3*q^11 + 3*q^19 + 4*q^27 + 6*q^35 + 3*q^43 + 6*q^51 + 9*q^59 + 3*q^67 + ...
		

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102.
  • C. F. Gauss, Disquisitiones Arithmeticae, Yale University Press, 1966, New Haven and London, p. 342, art. 293.
  • M. Nathanson, Additive Number Theory: The Classical Bases, Graduate Texts in Mathematics, Volume 165, Springer-Verlag, 1996. See Chapter 1.

Crossrefs

Number of ways of writing n as a sum of k triangular numbers, for k=1,...: A010054, A008441, A008443, A008438, A008439, A008440,A226252, A007331, A226253, A226254, A226255, A014787, A014809.
Partial sums are in A038835.

Programs

  • Magma
    Basis( ModularForms( Gamma0(16), 3/2), 630)[4]; /* Michael Somos, Aug 26 2015 */
  • Maple
    s1 := sum(q^(n*(n+1)/2), n=0..30): s2 := series(s1^3, q, 250): for i from 0 to 200 do printf(`%d,`,coeff(s2, q, i)) od:
  • Mathematica
    s1 = Sum[q^(n (n + 1)/2), {n, 0, 12}]; s2 = Series[s1^3, {q, 0, 80}]; CoefficientList[s2, q] (* Jean-François Alcover, Oct 04 2011, after Maple *)
    a[ n_] := SeriesCoefficient[ (1/8) EllipticTheta[ 2, 0, q]^3, {q, 0, 2 n + 3/4}]; (* Michael Somos, May 29 2012 *)
    QP = QPochhammer; CoefficientList[(QP[q^2]^2/QP[q])^3 + O[q]^80, q] (* Jean-François Alcover, Nov 24 2015 *)
  • PARI
    {a(n) = if( n<0, 0, polcoeff( sum(k=0, (sqrtint(8*n + 1) - 1)\2, x^((k^2 + k)/2), x * O(x^n))^3, n))}; /* Michael Somos, Oct 25 2006 */
    
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A)^2 / eta(x + A))^3, n))}; /* Michael Somos, Oct 25 2006 */
    

Formula

Expansion of Jacobi theta constant theta_2^3 /8. G.f. is cube of g.f. for A010054.
Expansion of psi(q)^3 in powers of q where psi() is a Ramanujan theta function (A010054). - Michael Somos, Oct 25 2006
Expansion of q^(-3/8) * (eta(q^2)^2 / eta(q))^3 in powers of q. - Michael Somos, May 29 2012
Euler transform of period 2 sequence [ 3, -3, ...]. - Michael Somos, Oct 25 2006
G.f. is a period 1 Fourier series which satisfies f(-1 / (16 t)) = 2^(-3/2) (t/i)^(3/2) g(t) where q = exp(2 Pi i t) and g() is the g.f. for A213384. - Michael Somos, Jun 23 2012
a(3*n) = A213627(n). a(3*n + 1) = 3 * A213617(n). a(3*n + 2) = A181648(n). - Michael Somos, Jun 23 2012
G.f.: (Sum_{k>0} x^((k^2 - k)/2))^3 = (Product_{k>0} (1 + x^k) * (1 - x^(2*k)))^3. - Michael Somos, May 29 2012
a(n) = A005869(n)/2 = A005886(n)/4 = A005878(n)/8.
a(n) = A005875(8*n+3)/8. See, e.g., the Ono et al. link: The case k=3. - Wolfdieter Lang, Jan 12 2017
a(0) = 1, a(n) = (3/n)*Sum_{k=1..n} A002129(k)*a(n-k) for n > 0. - Seiichi Manyama, May 06 2017

Extensions

More terms from James Sellers, Feb 07 2001

A010467 Decimal expansion of square root of 10.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Continued fraction expansion is 3 followed by {6} repeated. - Harry J. Smith, Jun 02 2009
In 1594, Joseph Scaliger claimed Pi = sqrt(10), but Ludolph van Ceulen immediately knew this to be wrong. - Alonso del Arte, Jan 17 2013
The 7th-century Hindu mathematician Brahmagupta used this constant as value of Pi. - Stefano Spezia, Jul 08 2022

Examples

			3.162277660168379331998893544432718533719555139325216826857504852792594...
		

References

  • Petr Beckmann, A History of Pi, 3rd Ed., Boulder, Colorado: The Golem Press (1974): p. 27.
  • Florian Cajori, A History of Mathematical Notations, Dover edition (2012), par. 112.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 238.
  • Steven R. Finch, Mathematical Constants, Encyclopedia of Mathematics and its Applications, vol. 94, Cambridge University Press, 2003, Section 2.31.4, p. 201.
  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §3.6 The Quest for Pi, pp. 89, 91.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 55.

Crossrefs

Cf. A000032, A040006 (continued fraction).

Programs

  • Magma
    SetDefaultRealField(RealField(100)); Sqrt(10); // Vincenzo Librandi, Feb 15 2020
  • Mathematica
    RealDigits[N[Sqrt[10],200]] (* Vladimir Joseph Stephan Orlovsky, May 27 2010 *)
  • PARI
    default(realprecision, 20080); x=sqrt(10); for (n=1, 20000, d=floor(x); x=(x-d)*10; write("b010467.txt", n, " ", d));  \\ Harry J. Smith, Jun 02 2009
    

Formula

Sqrt(10) = sqrt(1 + i*sqrt(15)) + sqrt(1 - i*sqrt(15)) = sqrt(1/2 + 2*i*sqrt(5)) + sqrt(1/2 - 2*i*sqrt(5)), where i = sqrt(-1). - Bruno Berselli, Nov 20 2012
Equals 1/sqrt(10), with offset 0. - Michel Marcus, Mar 10 2021
Equals 2 + Sum_{k>=1} Lucas(k)*binomial(2*k,k)/8^k. - Amiram Eldar, Jan 17 2022
a(k) = floor(Sum_{n>=1} A005875(n)/exp(Pi*n/(10^((2/3)*k+(1/3))))) mod 10. Will give the k-th decimal digit of sqrt(10). A005875 : number of ways to write n as sum of 3 squares. - Simon Plouffe, Dec 30 2023

A025428 Number of partitions of n into 4 nonzero squares.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Records occur at n= 4, 28, 52, 82, 90, 130, 162, 198, 202, 210,.... - R. J. Mathar, Sep 15 2015

Crossrefs

Cf. A000414, A000534, A025357-A025375, A216374, A025416 (greedy inverse).
Column k=4 of A243148.

Programs

  • Maple
    A025428 := proc(n)
        local a,i,j,k,lsq ;
        a := 0 ;
        for i from 1 do
            if 4*i^2 > n then
                return a;
            end if;
            for j from i do
                if i^2+3*j^2 > n then
                    break;
                end if;
                for k from j do
                    if i^2+j^2+2*k^2 > n then
                        break;
                    end if;
                    lsq := n-i^2-j^2-k^2 ;
                    if lsq >= k^2 and issqr(lsq) then
                        a := a+1 ;
                    end if;
                end do:
            end do:
        end do:
    end proc:
    seq(A025428(n),n=1..40) ; # R. J. Mathar, Jun 15 2018
    # second Maple program:
    b:= proc(n, i, t) option remember; `if`(n=0, `if`(t=0, 1, 0),
         `if`(i<1 or t<1, 0, b(n, i-1, t)+`if`(i^2>n, 0, b(n-i^2, i, t-1))))
        end:
    a:= n-> b(n, isqrt(n), 4):
    seq(a(n), n=0..100);  # Alois P. Heinz, Apr 14 2019
  • Mathematica
    nn = 100; lim = Sqrt[nn]; t = Table[0, {nn}]; Do[n = a^2 + b^2 + c^2 + d^2; If[n <= nn, t[[n]]++], {a, lim}, {b, a, lim}, {c, b, lim}, {d, c, lim}]; t (* T. D. Noe, Sep 28 2012 *)
    f[n_] := Length@ IntegerPartitions[n, {4}, Range[ Floor[ Sqrt[n - 1]]]^2]; Array[f, 105] (* Robert G. Wilson v, Sep 28 2012 *)
  • PARI
    A025428(n)=sum(a=1,n,sum(b=1,a,sum(c=1,b,sum(d=1,c,a^2+b^2+c^2+d^2==n))))
    
  • PARI
    A025428(n)=sum(a=1,sqrtint(max(n-3,0)), sum(b=1,min(sqrtint(n-a^2-2),a), sum(c=1,min(sqrtint(n-a^2-b^2-1),b),issquare(n-a^2-b^2-c^2,&d) & d <= c )))
    
  • PARI
    A025428(n)=sum(a=sqrtint(max(n,4)\4),sqrtint(max(n-3,0)), sum(b=sqrtint((n-a^2)\3-1)+1,min(sqrtint(n-a^2-2),a), sum(c=sqrtint((t=n-a^2-b^2)\2-1)+1, min(sqrtint(t-1),b), issquare(t-c^2) ))) \\ - M. F. Hasler, Sep 17 2012
    for(n=1,100,print1(A025428(n),","))
    
  • PARI
    T(n)={a=matrix(n,4,i,j,0);for(d=1,sqrtint(n),forstep(i=n,d*d+1,-1,for(j=2,4,a[i,j]+=sum(k=1,j,if(k0,a[i-k*d*d,j-k],if(k==j&&i-k*d*d==0,1)))));a[d*d,1]=1);for(i=1,n,print(i" "a[i,4]))} /* Robert Gerbicz, Sep 28 2012 */

Formula

For n>0, a(n) = ( A063730(n) + 6*A213024(n) + 3*A063725(n/2) + 8*A092573(n) + 6*A010052(n/4) ) / 24. - Max Alekseyev, Sep 30 2012
a(n) = ( A000118(n) - 4*A005875(n) - 6*A004018(n) - 12*A000122(n) - 15*A000007(n) + 12*A014455(n) - 24*A033715(n) - 12*A000122(n/2) + 12*A004018(n/2) + 32*A033716(n) - 32*A000122(n/3) + 48*A000122(n/4) ) / 384. - Max Alekseyev, Sep 30 2012
a(n) = [x^n y^4] Product_{k>=1} 1/(1 - y*x^(k^2)). - Ilya Gutkovskiy, Apr 19 2019
a(n) = Sum_{k=1..floor(n/4)} Sum_{j=k..floor((n-k)/3)} Sum_{i=j..floor((n-j-k)/2)} A010052(i) * A010052(j) * A010052(k) * A010052(n-i-j-k). - Wesley Ivan Hurt, Apr 19 2019

Extensions

Values of a(0..10^4) double-checked by M. F. Hasler, Sep 17 2012

A122141 Array: T(d,n) = number of ways of writing n as a sum of d squares, read by ascending antidiagonals.

Original entry on oeis.org

1, 1, 2, 1, 4, 0, 1, 6, 4, 0, 1, 8, 12, 0, 2, 1, 10, 24, 8, 4, 0, 1, 12, 40, 32, 6, 8, 0, 1, 14, 60, 80, 24, 24, 0, 0, 1, 16, 84, 160, 90, 48, 24, 0, 0, 1, 18, 112, 280, 252, 112, 96, 0, 4, 2, 1, 20, 144, 448, 574, 312, 240, 64, 12, 4, 0, 1, 22, 180, 672, 1136, 840, 544, 320, 24, 30, 8, 0
Offset: 1

Views

Author

R. J. Mathar, Oct 29 2006

Keywords

Comments

This is the transpose of the array in A286815.
T(d,n) is divisible by 2d for any n != 0 iff d is a power of 2. - Jianing Song, Sep 05 2018

Examples

			Array T(d,n) with rows d = 1,2,3,... and columns n = 0,1,2,3,... reads
  1  2   0   0    2    0     0     0     0     2      0 ...
  1  4   4   0    4    8     0     0     4     4      8 ...
  1  6  12   8    6   24    24     0    12    30     24 ...
  1  8  24  32   24   48    96    64    24   104    144 ...
  1 10  40  80   90  112   240   320   200   250    560 ...
  1 12  60 160  252  312   544   960  1020   876   1560 ...
  1 14  84 280  574  840  1288  2368  3444  3542   4424 ...
  1 16 112 448 1136 2016  3136  5504  9328 12112  14112 ...
  1 18 144 672 2034 4320  7392 12672 22608 34802  44640 ...
  1 20 180 960 3380 8424 16320 28800 52020 88660 129064 ...
		

Crossrefs

Cf. A000122 (1st row), A004018 (2nd row), A005875 (3rd row), A000118 (4th row), A000132 (5th row), A000141 (6th row), A008451 (7th row), A000143 (8th row), A008452 (9th row), A000144 (10th row), A008453 (11th row), A000145 (12th row), A276285 (13th row), A276286 (14th row), A276287 (15th row), A000152 (16th row).
Cf. A005843 (2nd column), A046092 (3rd column), A130809 (4th column).
Cf. A010052 (1st row divides 2), A002654 (2nd row divides 4), A046897 (4th row divides 8), A008457 (8th row divides 16), A302855 (16th row divides 32), A302857 (32nd row divides 64).

Programs

  • Maple
    A122141 := proc(d,n) local i,cnts ; cnts := 0 ; for i from -trunc(sqrt(n)) to trunc(sqrt(n)) do if n-i^2 >= 0 then if d > 1 then cnts := cnts+procname(d-1,n-i^2) ; elif n-i^2 = 0 then cnts := cnts+1 ; fi ; fi ; od ; cnts ;
    end:
    for diag from 1 to 14 do for n from 0 to diag-1 do d := diag-n ; printf("%d,",A122141(d,n)) ; od ; od;
    # second Maple program:
    A:= proc(d, n) option remember; `if`(n=0, 1, `if`(n<0 or d<1, 0,
          A(d-1, n) +2*add(A(d-1, n-j^2), j=1..isqrt(n))))
        end:
    seq(seq(A(h-n, n), n=0..h-1), h=1..14); # Alois P. Heinz, Jul 16 2014
  • Mathematica
    Table[ SquaresR[d - n, n], {d, 1, 12}, {n, 0, d - 1}] // Flatten (* Jean-François Alcover, Jun 13 2013 *)
    A[d_, n_] := A[d, n] = If[n==0, 1, If[n<0 || d<1, 0, A[d-1, n] + 2*Sum[A[d-1, n-j^2], {j, 1, Sqrt[n]}]]]; Table[A[h-n, n], {h, 1, 14}, {n, 0, h-1}] // Flatten (* Jean-François Alcover, Feb 28 2018, after Alois P. Heinz *)
  • Python
    from sympy.core.power import isqrt
    from functools import cache
    @cache
    def T(d, n):
      if n == 0: return 1
      if n < 0 or d < 1: return 0
      return T(d-1, n) + sum(T(d-1, n-(j**2)) for j in range(1, isqrt(n)+1)) * 2  # Darío Clavijo, Feb 06 2024

Formula

T(n,n) = A066535(n). - Alois P. Heinz, Jul 16 2014

A000164 Number of partitions of n into 3 squares (allowing part zero).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n) = number of triples of integers [ i, j, k] such that i >= j >= k >= 0 and n = i^2 + j^2 + k^2. - Michael Somos, Jun 05 2012

Examples

			G.f. = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^8 + 2*x^9 + x^10 + x^11 + x^12 + x^13 + ...
		

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 84.

Crossrefs

Equivalent sequences for other numbers of squares: A000161 (2), A002635 (4), A000174 (5).
Cf. A004215 (positions of zeros), A094942 (positions of ones), A124966 (positions of greater values).

Programs

  • Maple
    A000164 := proc(n)
        local a,x,y,z2,z ;
        a := 0 ;
        for x from 0 do
            if 3*x^2 > n then
                return a;
            end if;
            for y from x do
                if x^2+2*y^2 > n then
                    break;
                end if;
                z2 := n-x^2-y^2 ;
                if issqr(z2) then
                    z := sqrt(z2) ;
                    if z >= y then
                        a := a+1 ;
                    end if;
                end if;
            end do:
        end do:
        a;
    end proc: # R. J. Mathar, Feb 12 2017
  • Mathematica
    Length[PowersRepresentations[ #, 3, 2]] & /@ Range[0, 104]
    e[0,r_,s_,m_]=0;e[n_,r_,s_,m_]:=Length[Select[Divisors[n],Mod[ #,m]==r &]]-Length[Select[Divisors[n],Mod[ #,m]==s &]];alpha[n_]:=5delta[n]+3delta[1/2 n]+4delta[1/3n];beta[n_]:=4e[n,1,3,4]+3e[n,1,7,8]+3e[n,3,5,8];delta[n_]:=If[IntegerQ[Sqrt[n]],1,0];f[n_]:=Table[n-k^2, {k,1,Floor[Sqrt[n]]}]; gamma[n_]:=2 Plus@@(e[ #,1,3,4] &/@f[n]);p3[n_]:=1/12(alpha[n]+beta[n]+gamma[n]);p3[ # ] &/@Range[0,104]
    (* Ant King, Oct 15 2010 *)
    a[ n_] := If[ n < 0, 0, Sum[ Boole[ n == i^2 + j^2 + k^2], {i, 0, Sqrt[n]}, {j, 0, i}, {k, 0, j}]]; (* Michael Somos, Aug 15 2015 *)
  • PARI
    {a(n) = if( n<0, 0, sum( i=0, sqrtint(n), sum( j=0, i, sum( k=0, j, n == i^2 + j^2 + k^2))))}; /* Michael Somos, Jun 05 2012 */
    
  • Python
    import collections; a = collections.Counter(i*i + j*j + k*k for i in range(100) for j in range(i+1) for k in range(j+1)) # David Radcliffe, Apr 15 2019

Formula

Let e(n,r,s,m) be the excess of the number of n's r(mod m) divisors over the number of its s (mod m) divisors, and let delta(n)=1 if n is a perfect square and 0 otherwise. Then, if we define alpha(n) = 5*delta(n) + 3*delta(n/2) + 4*delta(n/3), beta(n) = 4*e(n,1,3,4) + 3*e(n,1,7,8) + 3*e(n,3,5,8), gamma(n) = 2*Sum_{1<=k^2Ant King, Oct 15 2010

Extensions

Name clarified by Wolfdieter Lang, Apr 08 2013

A286815 Square array A(n,k), n>=0, k>=0, read by antidiagonals, where column k is the expansion of (Product_{j>=1} (1 - x^(2*j))^5/((1 - x^j)*(1 - x^(4*j)))^2)^k.

Original entry on oeis.org

1, 1, 0, 1, 2, 0, 1, 4, 0, 0, 1, 6, 4, 0, 0, 1, 8, 12, 0, 2, 0, 1, 10, 24, 8, 4, 0, 0, 1, 12, 40, 32, 6, 8, 0, 0, 1, 14, 60, 80, 24, 24, 0, 0, 0, 1, 16, 84, 160, 90, 48, 24, 0, 0, 0, 1, 18, 112, 280, 252, 112, 96, 0, 4, 2, 0, 1, 20, 144, 448, 574, 312, 240, 64, 12
Offset: 0

Views

Author

Seiichi Manyama, May 27 2017

Keywords

Comments

A(n,k) is the number of ways of writing n as a sum of k squares.
This is the transpose of the array in A122141.

Examples

			Square array begins:
   1, 1, 1,  1,  1, ...
   0, 2, 4,  6,  8, ...
   0, 0, 4, 12, 24, ...
   0, 0, 0,  8, 32, ...
   0, 2, 4,  6, 24, ...
		

Crossrefs

Programs

  • Maple
    A:= proc(n, k) option remember; `if`(n=0, 1, `if`(n<0 or k<1, 0,
          A(n, k-1) +2*add(A(n-j^2, k-1), j=1..isqrt(n))))
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..12);  # Alois P. Heinz, May 27 2017
  • Mathematica
    A[n_, k_] := A[n, k] = If[n == 0, 1, If[n < 0 || k < 1, 0, A[n, k-1] + 2*Sum[A[n-j^2, k-1], {j, 1, Sqrt[n]}]]];
    Table[A[n, d-n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, Feb 28 2018, after Alois P. Heinz *)

Formula

G.f. of column k: (Product_{j>=1} (1 - x^(2*j))^5/((1 - x^j)*(1 - x^(4*j)))^2)^k.
Showing 1-10 of 84 results. Next