OFFSET
0,4
COMMENTS
LINKS
Joerg Arndt and Alois P. Heinz, Table of n, a(n) for n = 0..70
EXAMPLE
The a(5)=20 ballot sequences of length 5 with 1 maximal element are (dots for zeros):
01: [ . . . . 1 ]
02: [ . . . 1 . ]
03: [ . . . 1 2 ]
04: [ . . 1 . . ]
05: [ . . 1 . 2 ]
06: [ . . 1 1 2 ]
07: [ . . 1 2 . ]
08: [ . . 1 2 1 ]
09: [ . . 1 2 3 ]
10: [ . 1 . . . ]
11: [ . 1 . . 2 ]
12: [ . 1 . 1 2 ]
13: [ . 1 . 2 . ]
14: [ . 1 . 2 1 ]
15: [ . 1 . 2 3 ]
16: [ . 1 2 . . ]
17: [ . 1 2 . 1 ]
18: [ . 1 2 . 3 ]
19: [ . 1 2 3 . ]
20: [ . 1 2 3 4 ]
MAPLE
h:= proc(l) local n; n:=nops(l); add(i, i=l)!/mul(mul(1+l[i]-j+
add(`if`(l[k]>=j, 1, 0), k=i+1..n), j=1..l[i]), i=1..n)
end:
g:= proc(n, i, l) `if`(n=0, 0, `if`(i=1, h([l[], 1$n]),
add(g(n-i*j, i-1, [l[], i$j]), j=0..n/i)))
end:
a:= n-> g(n, n, []):
seq(a(n), n=0..30);
MATHEMATICA
b[n_, l_List] := b[n, l] = If[n < 1, x^l[[-1]], b[n - 1, Append[l, 1]] + Sum[If[i == 1 || l[[i - 1]] > l[[i]], b[n - 1, ReplacePart[l, i -> l[[i]] + 1]], 0], {i, 1, Length[l]}]]; a[0] = 0; a[n_] := Coefficient[b[n - 1, {1}], x, 1]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Feb 10 2015, after A238123 *)
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Joerg Arndt and Alois P. Heinz, Feb 21 2014
STATUS
approved