OFFSET
1
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..100000
FORMULA
MATHEMATICA
f[p_, e_] := If[e == 1, 1, 0]; f[2, e_] := If[e == 1, -1, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Dec 29 2022 *)
PROG
(PARI) A359155(n) = { my(f = factor(n)); prod(k=1, #f~, (1==f[k, 2])*((-1)^(1+f[k, 1]))); };
(PARI) A359155(n) = { my(f = factor(n)); moebius(n)*prod(k=1, #f~, (-1)^(f[k, 1]*f[k, 2])); };
(Python)
from functools import reduce
from operator import ixor
from sympy import factorint
def A359155(n): return 0 if max((f:=factorint(n)).values(), default=0) > 1 else -1 if reduce(ixor, (p&1^1 for p in f.keys()), 0) else 1 # Chai Wah Wu, Dec 21 2022
CROSSREFS
KEYWORD
sign,mult
AUTHOR
Antti Karttunen, Dec 19 2022
STATUS
approved