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.

A045852 Number of nonnegative solutions of x1^2 + x2^2 + ... + x10^2 = n.

This page as a plain text file.
%I A045852 #26 Feb 10 2021 20:51:45
%S A045852 1,10,45,120,220,342,570,960,1350,1640,2191,3240,4200,4720,5760,7920,
%T A045852 9865,10620,11965,15600,19332,20550,22200,28080,34200,35582,37395,
%U A045852 45720,54600,56970,59460,71040,84330,87090,88195,104040,123200,125710,126540,148560
%N A045852 Number of nonnegative solutions of x1^2 + x2^2 + ... + x10^2 = n.
%H A045852 Seiichi Manyama, <a href="/A045852/b045852.txt">Table of n, a(n) for n = 0..10000</a> (terms 0..2000 from T. D. Noe)
%F A045852 Coefficient of q^n in (1 + q + q^4 + q^9 + q^16 + q^25 + q^36 + q^49 + q^64 + ...)^10.
%F A045852 G.f.: ((1 + theta_3(x)) / 2)^10. - _Ilya Gutkovskiy_, Feb 10 2021
%p A045852 b:= proc(n, k) option remember; `if`(n=0, 1, `if`(n<0 or k<1, 0,
%p A045852       b(n, k-1)+add(b(n-j^2, k-1), j=1..isqrt(n))))
%p A045852     end:
%p A045852 a:= b(n, 10):
%p A045852 seq(a(n), n=0..40);  # _Alois P. Heinz_, Feb 10 2021
%t A045852 Take[CoefficientList[Expand[(Total[x^Range[0,5]^2])^10],x],50] (* _Harvey P. Dale_, May 20 2011 *)
%o A045852 (Ruby)
%o A045852 def mul(f_ary, b_ary, m)
%o A045852   s1, s2 = f_ary.size, b_ary.size
%o A045852   ary = Array.new(s1 + s2 - 1, 0)
%o A045852   (0..s1 - 1).each{|i|
%o A045852     (0..s2 - 1).each{|j|
%o A045852       ary[i + j] += f_ary[i] * b_ary[j]
%o A045852     }
%o A045852   }
%o A045852   ary[0..m]
%o A045852 end
%o A045852 def power(ary, n, m)
%o A045852   if n == 0
%o A045852     a = Array.new(m + 1, 0)
%o A045852     a[0] = 1
%o A045852     return a
%o A045852   end
%o A045852   k = power(ary, n >> 1, m)
%o A045852   k = mul(k, k, m)
%o A045852   return k if n & 1 == 0
%o A045852   return mul(k, ary, m)
%o A045852 end
%o A045852 def A(k, n)
%o A045852   ary = Array.new(n + 1, 0)
%o A045852   (0..Math.sqrt(n).to_i).each{|i| ary[i * i] = 1}
%o A045852   power(ary, k, n)
%o A045852 end
%o A045852 p A(10, 100) # _Seiichi Manyama_, May 28 2017
%Y A045852 Cf. A010052, A045847.
%K A045852 nonn
%O A045852 0,2
%A A045852 _N. J. A. Sloane_