login
A262192
Number of compositions of n such that the maximal distance between two identical parts equals one.
2
0, 0, 1, 0, 3, 4, 5, 12, 21, 36, 43, 88, 133, 222, 331, 450, 753, 1120, 1703, 2508, 3753, 5010, 7807, 11020, 16243, 22974, 33277, 46764, 63639, 91822, 127943, 180048, 249585, 348204, 480361, 664618, 884833, 1237470, 1675087, 2299104, 3103203, 4234072, 5700371
OFFSET
0,5
LINKS
Vaclav Kotesovec, Table of n, a(n) for n = 0..900 (terms 0..650 from Alois P. Heinz)
EXAMPLE
a(2) = 1: 11.
a(4) = 3: 22, 112, 211.
a(5) = 4: 113, 122, 221, 311.
a(6) = 5: 33, 114, 411, 1122, 2211.
a(7) = 12: 115, 133, 223, 322, 331, 511, 1123, 1132, 2113, 2311, 3112, 3211.
a(8) = 21: 44, 116, 224, 233, 332, 422, 611, 1124, 1133, 1142, 1223, 1322, 2114, 2213, 2231, 2411, 3122, 3221, 3311, 4112, 4211.
MAPLE
g:= proc(n, k) option remember; `if`(k<0 or n<0, 0,
`if`(k=0, `if`(n=0, 1, 0), g(n-k, k)+k*g(n-k, k-1)))
end:
b:= proc(n, i) option remember; expand(`if`(i*(i+1)<n, 0,
`if`(n=0, 1, `if`(i<1, 0, add(b(n-i*j, i-1)*
`if`(j=0, 1, x) , j=0..2)))))
end:
a:= n-> (p-> add(coeff(p, x, i)*i!, i=0..degree(p)))(b(n$2))
-add(g(n, k), k=0..floor((sqrt(8*n+1)-1)/2)):
seq(a(n), n=0..50);
MATHEMATICA
g[n_, k_] := g[n, k] = If[k < 0 || n < 0, 0, If[k == 0, If[n == 0, 1, 0], g[n - k, k] + k*g[n - k, k - 1]]];
b[n_, i_] := b[n, i] = Expand[If[i(i+1) < n, 0, If[n == 0, 1, If[i < 1, 0, Sum[b[n - i*j, i - 1]*If[j == 0, 1, x], {j, 0, 2}]]]]];
a[n_] := With[{p = b[n, n]}, Sum[Coefficient[p, x, i]*i!, {i, 0, Exponent[p, x]}]] - Sum[g[n, k], {k, 0, Floor[(Sqrt[8n + 1] - 1)/2]}];
a /@ Range[0, 50] (* Jean-François Alcover, Dec 29 2020, after Alois P. Heinz *)
CROSSREFS
Column k=1 of A262191.
Sequence in context: A141290 A010752 A049929 * A280308 A289121 A060738
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 14 2015
STATUS
approved