login
A352012
a(n) = Sum_{p|n, p prime} (n-1)!/(p-1)!.
6
0, 1, 1, 6, 1, 180, 1, 5040, 20160, 378000, 1, 59875200, 1, 6235669440, 47221574400, 1307674368000, 1, 533531142144000, 1, 126713646259200000, 1219830034655232000, 51090956251003468800, 1, 38778025108327464960000, 25852016738884976640000
OFFSET
1,4
LINKS
FORMULA
E.g.f.: -Sum_{p prime} log(1-x^p)/p!.
a(n) = 1 if and only if n is prime.
MAPLE
f:= proc(n) local p;
add( (n-1)!/(p-1)!, p = numtheory:-factorset(n))
end proc:
map(f, [$1..30]): # Robert Israel, Nov 14 2024
MATHEMATICA
a[1] = 0; a[n_] := (n - 1)! * Plus @@ (1/(FactorInteger[n][[;; , 1]] - 1)!); Array[a, 25] (* Amiram Eldar, Mar 01 2022 *)
PROG
(PARI) a(n) = sumdiv(n, d, isprime(d)*(n-1)!/(d-1)!);
(PARI) my(N=40, x='x+O('x^N)); concat(0, Vec(serlaplace(-sum(k=1, N, isprime(k)*log(1-x^k)/k!))))
(PARI) a(n) = my(f=factor(n)); sum(k=1, #f~, (n-1)!/(f[k, 1]-1)!); \\ Michel Marcus, Mar 01 2022
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Seiichi Manyama, Feb 28 2022
STATUS
approved