OFFSET
1,3
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..20000
FORMULA
a(1) = 1; a(n) = -Sum_{d|n, d < n} A026741(n/d) * a(d).
a(2n+1) = A349343(2n+1) for all n >= 1.
Multiplicative with a(2^e) = -1, a(p) = -p and a(p^e) = 0 if e > 1. - Sebastian Karlsson, Nov 15 2021
MATHEMATICA
a[1]=1; a[n_]:=-DivisorSum[n, If[OddQ[n/#], n/#, n/(2#)]*a@#&, #<n&]; Array[a, 79] (* Giorgos Kalogeropoulos, Nov 15 2021 *)
f[p_, e_] := If[e == 1, -p, 0]; f[2, e_] := -1; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 18 2023 *)
PROG
(PARI) A349341(n) = { my(f = factor(n)); prod(i=1, #f~, if(2==f[i, 1], -1, if(1==f[i, 2], -f[i, 1], 0))); };
(Python)
from sympy import prevprime, factorint, prod
def f(p, e):
return -1 if p == 2 else 0 if e > 1 else -p
def a(n):
return prod(f(p, e) for p, e in factorint(n).items()) # Sebastian Karlsson, Nov 15 2021
CROSSREFS
KEYWORD
sign,easy,mult
AUTHOR
Antti Karttunen, Nov 15 2021
STATUS
approved