OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..300
FORMULA
a(0) = 1, a(2*n) = (2^n+n-1)*(n-1)! for n>0, a(2*n+1) = n!.
EXAMPLE
a(4) = 5: (1,2,3,4), (2,1,4,3), (2,3,4,1), (3,4,1,2), (4,1,2,3).
a(5) = 2: (1,2,3,4,5), (3,4,1,2,5).
MAPLE
a:= n-> `if`(n=0, 1, `if`(irem(n, 2, 'r')=0, (2^r+r-1)*(r-1)!, r!)):
seq(a(n), n=0..35);
MATHEMATICA
a[n_] := If[n == 0, 1, With[{r = Quotient[n, 2]},
If[Mod[n, 2] == 0, (2^r+r-1)(r-1)!, r!]]];
Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Oct 30 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alois P. Heinz, Nov 08 2011
STATUS
approved