OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..450
FORMULA
E.g.f: exp(x)-1 + exp(x)*Sum_{p prime} (exp(x^p/p)-1). - Robert Israel, Sep 18 2018
EXAMPLE
For n = 4 there is 1 permutation of order 1, 9 permutations of order 2, 8 of order 3 and no others of prime order, so a(4)=18.
MAPLE
f:= proc(n) local p, t, k;
p:= 1; t:= 1;
do
p:= nextprime(p);
if p > n then return t fi;
for k from 1 to n/p do
t:= t + n!/(p^k*(n-k*p)!*k!)
od
od
end proc:
map(f, [$1..30]); # Robert Israel, Sep 18 2018
MATHEMATICA
f[n_] := Module[{p = 1, t = 1, k}, While[True, p = NextPrime[p]; If[p > n, Return [t]]; For[k = 1, k <= n/p, k++, t = t + n!/(p^k (n - k p)! k!)]]];
f /@ Range[30] (* Jean-François Alcover, Aug 15 2020, after Robert Israel *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladeta Jovovic, Mar 19 2001
EXTENSIONS
Name corrected by Robert Israel, Sep 18 2018
STATUS
approved