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.

Original entry on oeis.org

1, 10, 45, 120, 220, 342, 570, 960, 1350, 1640, 2191, 3240, 4200, 4720, 5760, 7920, 9865, 10620, 11965, 15600, 19332, 20550, 22200, 28080, 34200, 35582, 37395, 45720, 54600, 56970, 59460, 71040, 84330, 87090, 88195, 104040, 123200, 125710, 126540, 148560
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(n=0, 1, `if`(n<0 or k<1, 0,
          b(n, k-1)+add(b(n-j^2, k-1), j=1..isqrt(n))))
        end:
    a:= b(n, 10):
    seq(a(n), n=0..40);  # Alois P. Heinz, Feb 10 2021
  • Mathematica
    Take[CoefficientList[Expand[(Total[x^Range[0,5]^2])^10],x],50] (* Harvey P. Dale, May 20 2011 *)
  • 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(10, 100) # Seiichi Manyama, May 28 2017

Formula

Coefficient of q^n in (1 + q + q^4 + q^9 + q^16 + q^25 + q^36 + q^49 + q^64 + ...)^10.
G.f.: ((1 + theta_3(x)) / 2)^10. - Ilya Gutkovskiy, Feb 10 2021