OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = f(1) where f is the monic polynomial whose zeros are the prime factors of n with multiplicity.
a(p) = 1-p for any prime number p.
Completely multiplicative with a(p) = 1-p. - Franklin T. Adams-Watters, Jan 17 2007
a(n) = f(1), where f(x)=(x-p_1)(x-p_2)...(x-p_m), where { p_1,p_2,...p_m } are the prime factors of n with multiplicity.
Dirichlet g.f.: Product_{primes p} 1/(1 + p^(1-s) - p^(-s)). - Vaclav Kotesovec, Jun 14 2020
EXAMPLE
a(120) = -8 because the prime factorization of 120 is 2*2*2*3*5, so f(x)=(x-2)(x-2)(x-2)(x-3)(x-5) and f(1)=(-1)*(-1)*(-1)*(-2)*(-4)= -8.
MAPLE
a:= n-> mul((1-i[1])^i[2], i=ifactors(n)[2]):
seq(a(n), n=1..80); # Alois P. Heinz, Jun 28 2015
MATHEMATICA
a[n_] := Times @@ (-Flatten[Table[ #1, {#2}] & @@@ FactorInteger@n] + 1);
Array[a, 80] (* Robert G. Wilson v, Jan 10 2007; corrected by Michael Shamos, Aug 12 2023 *)
PROG
(R) f=polyroot(factor(x)); f(1)
(PARI) a(n)=my(f=factor(n)); prod(i=1, #f~, (1-f[i, 1])^f[i, 2]) \\ Charles R Greathouse IV, Jun 28 2015
(PARI) for(n=1, 100, print1(direuler(p=2, n, 1/(1 + p*X - X))[n], ", ")) \\ Vaclav Kotesovec, Jun 14 2020
CROSSREFS
KEYWORD
easy,sign,mult
AUTHOR
Mitch Cervinka (puritan(AT)toast.net), Jan 10 2007
EXTENSIONS
Edited by Franklin T. Adams-Watters, Jan 17 2007
STATUS
approved