editing
approved
editing
approved
b:= proc(n, i) option remember; `if`(n<1 or i<1, 0,
`if`(n<1 or i<1, 0, `if`(n=i, 1, add(b(n-i, i+j), j=-2..2)))
seq (a(n), n=0..50);
approved
editing
proposed
approved
editing
proposed
Number of compositions of n where differences between neighboring parts are in {-2,...,2}.
proposed
editing
editing
proposed
b[n_, i_] := b[n, i] = If[n < 1 || i < 1, 0, If[n == i, 1, Sum[b[n-i, i+j], {j, -2, 2}]]]; a[n_] := If[n == 0, 1, Sum[b[n, j], {j, 1, n}]]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Nov 06 2014, after Alois P. Heinz *)
approved
editing
editing
approved
a(n) ~ c * d^n, where d = 1.8630486786572002290749607226537419966705160765891889162715127426..., c = 0.6251341184281574379681933375704862852528326365321195333127800734... . - Vaclav Kotesovec, Sep 02 2014
approved
editing
proposed
approved