login
A324621
Number of permutations p of [1+n] such that n is the maximum of the number of elements in any integer interval [p(i)..i+(1+n)*[i<p(i)]].
3
0, 1, 1, 7, 31, 185, 1275, 10095, 90109, 895169, 9793829, 116998199, 1515196619, 21143666585, 316260079951, 5047672782687, 85623656678457, 1538245254809537, 29176112648650441, 582614412521648359, 12217688610474042487, 268445509189890555577
OFFSET
0,4
LINKS
FORMULA
a(n) = A000166(n+1) - A000179(n+1) for n < 0, a(0) = 0.
MAPLE
a:= proc(n) option remember; `if`(n<5, [0, 1$2, 7, 31][n+1],
((2*n^4-3*n^3-2*n^2+n+4)*a(n-1) -(n^5-4*n^4+7*n^2+6*n-14)*
a(n-2) -(n^5-2*n^4-4*n^3+2*n^2+13*n-12)*a(n-3)-(n-2)*
(n^3+2*n^2+n-2)*a(n-4))/(n^3-n^2-2))
end:
seq(a(n), n=0..23);
MATHEMATICA
menage[n_] := If[n == 0, 1, 2n Sum[(-1)^k Binomial[2n-k, k] (n-k)!/(2n-k), {k, 0, n}]];
a[n_] := If[n == 0, 0, Subfactorial[n+1] - menage[n+1]];
a /@ Range[0, 21] (* Jean-François Alcover, Oct 28 2021 *)
CROSSREFS
Row n=1 of A324563 and column of A324564 (as array).
Sequence in context: A322205 A139151 A139060 * A223144 A155521 A201116
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Mar 09 2019
STATUS
approved