login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A045853 Number of nonnegative solutions of x1^2 + x2^2 + ... + x12^2 = n. 1

%I #25 Mar 01 2021 06:10:10

%S 1,12,66,220,507,924,1584,2772,4521,6436,8712,12552,18041,23364,28776,

%T 37896,50997,62832,72996,89892,115776,139348,156816,185064,231759,

%U 274044,300828,343564,418638,487080,528528,592284,707421,814836,874170,959508,1128338

%N Number of nonnegative solutions of x1^2 + x2^2 + ... + x12^2 = n.

%H Seiichi Manyama, <a href="/A045853/b045853.txt">Table of n, a(n) for n = 0..10000</a> (terms 0..2000 from T. D. Noe)

%F Coefficient of q^n in (1 + q + q^4 + q^9 + q^16 + q^25 + q^36 + q^49 + q^64 + ...)^12.

%F G.f.: ((1 + theta_3(x)) / 2)^12. - _Ilya Gutkovskiy_, Feb 10 2021

%p b:= proc(n, k) option remember; `if`(n=0, 1, `if`(n<0 or k<1, 0,

%p b(n, k-1)+add(b(n-j^2, k-1), j=1..isqrt(n))))

%p end:

%p a:= b(n, 12):

%p seq(a(n), n=0..40); # _Alois P. Heinz_, Feb 10 2021

%t CoefficientList[((1 + EllipticTheta[3, 0, q])/2)^12 + O[q]^40, q] (* _Jean-François Alcover_, Mar 01 2021 *)

%o (Ruby)

%o def mul(f_ary, b_ary, m)

%o s1, s2 = f_ary.size, b_ary.size

%o ary = Array.new(s1 + s2 - 1, 0)

%o (0..s1 - 1).each{|i|

%o (0..s2 - 1).each{|j|

%o ary[i + j] += f_ary[i] * b_ary[j]

%o }

%o }

%o ary[0..m]

%o end

%o def power(ary, n, m)

%o if n == 0

%o a = Array.new(m + 1, 0)

%o a[0] = 1

%o return a

%o end

%o k = power(ary, n >> 1, m)

%o k = mul(k, k, m)

%o return k if n & 1 == 0

%o return mul(k, ary, m)

%o end

%o def A(k, n)

%o ary = Array.new(n + 1, 0)

%o (0..Math.sqrt(n).to_i).each{|i| ary[i * i] = 1}

%o power(ary, k, n)

%o end

%o p A(12, 100) # _Seiichi Manyama_, May 28 2017

%Y Cf. A010052, A045847.

%K nonn

%O 0,2

%A _N. J. A. Sloane_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 06:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)