OFFSET
1
LINKS
FORMULA
a(1) = 1, for n > 1, a(n) = -Sum_{d|n, d<n} A353457(n/d) * a(d).
For all n >= 1, a(A000040(n)) = ((-1)^(n-1)).
The sequence is multiplicative. Let p be a prime. If the number of primes <= p [A000720(p)] is odd, then a(p^e) = 1. If the number of primes <= p is even, then a(p) = -1 and a(p^e) = 0 if e > 1. - Sebastian Karlsson, Apr 21 2022
MATHEMATICA
f[p_, e_] := If[OddQ[PrimePi[p]], 1, If[e == 1, -1, 0]]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Oct 23 2023 *)
PROG
(PARI)
A000265(n) = (n>>valuation(n, 2));
A064989(n) = { my(f=factor(A000265(n))); for(i=1, #f~, f[i, 1] = precprime(f[i, 1]-1)); factorback(f); };
memoA353457 = Map();
A353457(n) = if(1==n, 1, my(v); if(mapisdefined(memoA353457, n, &v), v, v = -sumdiv(n, d, if(d<n, A353457(A064989(n/d))*A353457(d), 0)); mapput(memoA353457, n, v); (v)));
(PARI) A353458(n) = { my(f=factor(n)); prod(i=1, #f~, if(primepi(f[i, 1])%2, 1, if(f[i, 2]==1, -1, 0))); }; \\ (After Sebastian Karlsson's multiplicative formula)
(Python)
from math import prod
from sympy import primepi, factorint
def A353458(n): return prod(-int(e==1) for p, e in factorint(n).items() if not primepi(p)&1) # Chai Wah Wu, Jan 05 2023
CROSSREFS
KEYWORD
sign,mult
AUTHOR
Antti Karttunen, Apr 21 2022
STATUS
approved