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.

A296010 Sum of the squares of the number of parts in all partitions of n.

Original entry on oeis.org

0, 1, 5, 14, 34, 68, 133, 232, 402, 652, 1048, 1609, 2465, 3640, 5358, 7694, 10993, 15399, 21498, 29520, 40394, 54572, 73425, 97756, 129710, 170525, 223428, 290552, 376551, 484819, 622317, 794167, 1010515, 1279376, 1615126, 2029948, 2544600, 3176856, 3956277
Offset: 0

Views

Author

Matthew C. Russell, Dec 02 2017

Keywords

Examples

			For n=4, the 5 partitions of 4 are 4, 3+1, 2+2, 2+1+1, and 1+1+1+1. These have 1, 2, 2, 3, and 4 parts, respectively. The sum of the squares is 1+4+4+9+16=34.
		

Crossrefs

Programs

  • Maple
    K:=[]:
    for n from 0 to 20 do
    co:=0:
    for L in combinat[partition](n) do
    co:=co+nops(L)^2:
    od:
    K:=[op(K),co]:
    od:
    K;
    # second Maple program:
    b:= proc(n, i, c) option remember; `if`(n=0 or i=1,
          (n+c)^2, `if`(i>n, 0, b(n-i, i, c+1))+b(n, i-1, c))
        end:
    a:= n-> b(n$2, 0):
    seq(a(n), n=0..50);  # Alois P. Heinz, Dec 02 2017
  • Mathematica
    f[n_] := Sum[i^2 (Length@ IntegerPartitions[n, {i}]), {i, n}]; Array[f, 34, 0] (* Robert G. Wilson v, Dec 02 2017 *)
    b[n_, i_, c_] := b[n, i, c] = If[n == 0 || i == 1,
         (n + c)^2, If[i > n, 0, b[n - i, i, c + 1]] + b[n, i - 1, c]];
    a[n_] := b[n, n, 0];
    a /@ Range[0, 50] (* Jean-François Alcover, Jun 06 2021, after Alois P. Heinz *)
  • PARI
    first(n)=my(x='x+O('x^(n+1)),pr=1); concat(0,Vec(sum(j=1,n,pr*=1-x^j; j^2*x^j/pr))) \\ Charles R Greathouse IV, Dec 02 2017

Formula

G.f.: Sum_{j>=1} j^2*x^j / Product_{i=1..j} (1-x^i). - Alois P. Heinz, Dec 02 2017