OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..234
FORMULA
EXAMPLE
a(0) = 1: (), the empty permutation.
a(1) = 1: 21.
a(2) = 4: 1234, 1243, 1342, 2341.
a(3) = 90: 143256, 143265, 153246, 153264, ..., 564213, 564231, 564312, 564321.
a(4) = 3024: 13245678, 13245687, 13245768, 13245786, ..., 78456213, 78456231, 78456312, 78456321.
MAPLE
b:= proc(u, o) option remember; `if`(u+o=0, 1,
add(b(o-1+j, u-j), j=1..u))
end:
a:= n-> (2*n)!/n!*`if`(n=0, 1, b(n, 0)-b(n+1, 0)/(n+1)):
seq(a(n), n=0..19);
PROG
(Python)
from fractions import Fraction
from math import factorial
from itertools import count, islice, accumulate
def A362603_gen(): # generator of terms
yield 1
blist, c = (0, 1), 1
for n in count(1):
blist, a, c = tuple(accumulate(reversed(blist), initial=0)), blist[-1], c*((n<<2)-2)
yield int(c*(a-Fraction(blist[-1], (n+1))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 27 2023
STATUS
approved