OFFSET
0,4
COMMENTS
a(p) = (p-1)! for p a prime.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..200
FORMULA
a(n) = n! - A079128(n) for n >= 1. - Alois P. Heinz, Jul 04 2021
EXAMPLE
a(6) = 265 counting permutations with cycle types: 6; 4-2; 3-3; 2-2-2; of which there are 120 + 90 + 40 + 15 = 265.
MAPLE
with(combinat):
b:= proc(n, i, g) option remember; `if`(n=0, `if`(g>1, 1, 0),
`if`(i<2, 0, b(n, i-1, g) +`if`(igcd(g, i)<2, 0,
add((i-1)!^j/j! *multinomial(n, i$j, n-i*j)*
b(n-i*j, i-1, igcd(i, g)), j=1..n/i))))
end:
a:= n-> b(n, n, 0):
seq(a(n), n=0..30); # Alois P. Heinz, Jun 06 2013
# second Maple program:
b:= proc(n, g) option remember; `if`(n=0, `if`(g>1, 1, 0), add(
(j-1)!*b(n-j, igcd(g, j))*binomial(n-1, j-1), j=1..n))
end:
a:= n-> b(n, 0):
seq(a(n), n=0..30); # Alois P. Heinz, Jul 04 2021
MATHEMATICA
f[list_] :=
Total[list]!/Apply[Times, Table[list[[i]], {i, 1, Length[list]}]]/
Apply[Times,
Select[Table[
Count[list, i], {i, 1, Total[list]}], # > 0 &]!]; Table[
Total[Map[f, Select[Partitions[n], Apply[GCD, #] > 1 &]]], {n, 0,
25}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Geoffrey Critzer, Jun 05 2013
STATUS
approved