login
A045851
Number of nonnegative solutions of x1^2 + x2^2 + ... + x9^2 = n.
6
1, 9, 36, 84, 135, 198, 336, 540, 675, 766, 1080, 1584, 1857, 1962, 2520, 3480, 3987, 3987, 4656, 6300, 7326, 7182, 8064, 10656, 12063, 11583, 12672, 16116, 18180, 17784, 19104, 23940, 27027, 25554
OFFSET
0,2
FORMULA
Coefficient of q^n in (1 + q + q^4 + q^9 + q^16 + q^25 + q^36 + q^49 + q^64 + ...)^9.
G.f.: (1 + theta_3(q))^9/512, where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Aug 08 2018
MATHEMATICA
(1 + EllipticTheta[3, 0, q])^9/512 + O[q]^40 // CoefficientList[#, q]& (* Jean-François Alcover, Aug 26 2019 *)
PROG
(PARI) seq(n)=Vec((sum(k=0, sqrtint(n), x^(k^2)) + O(x*x^n))^9) \\ Andrew Howroyd, Aug 08 2018
(Ruby)
def mul(f_ary, b_ary, m)
s1, s2 = f_ary.size, b_ary.size
ary = Array.new(s1 + s2 - 1, 0)
(0..s1 - 1).each{|i|
(0..s2 - 1).each{|j|
ary[i + j] += f_ary[i] * b_ary[j]
}
}
ary[0..m]
end
def power(ary, n, m)
if n == 0
a = Array.new(m + 1, 0)
a[0] = 1
return a
end
k = power(ary, n >> 1, m)
k = mul(k, k, m)
return k if n & 1 == 0
return mul(k, ary, m)
end
def A(k, n)
ary = Array.new(n + 1, 0)
(0..Math.sqrt(n).to_i).each{|i| ary[i * i] = 1}
power(ary, k, n)
end
p A(9, 100) # Seiichi Manyama, May 28 2017
CROSSREFS
Sequence in context: A229394 A173682 A009522 * A173243 A162258 A128642
KEYWORD
nonn
STATUS
approved