login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A333711
Number of permutations of [n] such that the product of the first k elements and the product of the last k elements are multiples of k! for all k in [n].
1
1, 1, 2, 2, 8, 4, 32, 4, 96, 244, 1400, 20, 3988, 12, 256, 1328, 3107082, 7900, 4352004, 2676, 752280, 4710724, 23591664, 672, 79424164, 51627164, 4705224, 802988332, 25488756038104, 47736592, 1706618983956, 826828
OFFSET
0,3
EXAMPLE
a(4) = 8: 1234, 1432, 2134, 2314, 2341, 4132, 4312, 4321.
a(5) = 4: 12345, 14325, 52341, 54321.
a(7) = 4: 1234567, 1654327, 7234561, 7654321.
a(13) = 12: 123456789(10)(11)(12)(13), 143256789(10)(11)(12)(13), 143(10)987652(11)(12)(13), 1(12)(11)256789(10)34(13), 1(12)(11)(10)98765234(13), 1(12)(11)(10)98765432(13), (13)23456789(10)(11)(12)1, (13)43256789(10)(11)(12)1, (13)43(10)987652(11)(12)1, (13)(12)(11)256789(10)341, (13)(12)(11)(10)987652341, (13)(12)(11)(10)987654321.
MAPLE
b:= proc(s, n) option remember; (m-> `if`(m=0, 1, `if`(irem(
mul(h, h=({$1..n} minus s)), (n-m)!)=0 and irem(mul(h,
h=s), m!)=0, add(b(s minus {j}, n), j=s), 0)))(nops(s))
end:
a:= n-> b({$1..n}, n):
seq(a(n), n=0..17);
MATHEMATICA
b[s_, n_] := b[s, n] = With[{m = Length[s]}, If[m == 0, 1, If[Mod[ Product[h, {h, Range[n] ~Complement~ s}], (n-m)!] == 0 && Mod[Times@@s, m!] == 0, Sum[b[s ~Complement~ {j}, n], {j, s}], 0]]];
a[n_] := b[Range[n], n];
Table[Print[n, " ", a[n]]; a[n], {n, 0, 27}] (* Jean-François Alcover, Nov 01 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 09 2020
STATUS
approved