A218506 Number of partitions of n in which any two parts differ by at most 4.
1, 1, 2, 3, 5, 7, 11, 14, 20, 25, 34, 41, 54, 64, 81, 95, 118, 136, 165, 189, 226, 256, 301, 339, 395, 441, 507, 564, 644, 711, 804, 885, 995, 1089, 1215, 1326, 1473, 1600, 1766, 1914, 2105, 2272, 2486, 2678, 2921, 3136, 3406, 3650, 3954, 4225, 4560, 4865
Offset: 0
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,1,0,1,-3,-1,0,1,3,-1,0,-1,-1,1).
Crossrefs
Column k=4 of A194621.
Programs
-
Maple
b:= proc(n, i, k) option remember; `if`(n<0 or k<0, 0, `if`(n=0, 1, `if`(i<1, 0, b(n, i-1, k-1) +b(n-i, i, k)))) end: a:= n-> `if`(n=0, 1, 0) +add(b(n-i, i, 4), i=1..n): seq(a(n), n=0..80);
-
Mathematica
b[n_, i_, k_] := b[n, i, k] = If[n < 0 || k < 0, 0, If[n == 0, 1, If[i < 1, 0, b[n, i - 1, k - 1] + b[n - i, i, k]]]]; a[n_] := If[n == 0, 1, 0] + Sum[b[n - i, i, 4], {i, 1, n}]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, May 20 2018, after Alois P. Heinz *)
-
PARI
Vec((x^14-x^13-x^12+2*x^9-x^6-x^5+x^4-1)/((x-1)^5*(x+1)^3*(x^2+1)^2*(x^2+x+1)) + O(x^100)) \\ Colin Barker, Mar 05 2015
Formula
G.f.: 1 + Sum_{j>0} x^j / Product_{i=0..4} (1-x^(i+j)).
G.f.: (x^14-x^13-x^12+2*x^9-x^6-x^5+x^4-1) / ((x-1)^5*(x+1)^3*(x^2+1)^2*(x^2+x+1)). - Colin Barker, Mar 05 2015