login
A353457
a(1) = 1, for n > 1, a(n) = -Sum_{d|n, d<n} a(A064989(n/d)) * a(d).
7
1, -1, 1, 0, -1, -1, 1, 0, 1, 1, -1, 0, 1, -1, -1, 0, -1, -1, 1, 0, 1, 1, -1, 0, 0, -1, 1, 0, 1, 1, -1, 0, -1, 1, -1, 0, 1, -1, 1, 0, -1, -1, 1, 0, -1, 1, -1, 0, 1, 0, -1, 0, 1, -1, 1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1, 1, -1, 0, -1, 1, 1, 0, -1, -1, 0, 0, -1, -1, 1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, 1, 1, 0, -1, 1, -1, 0
OFFSET
1
FORMULA
a(1) = 1, for n > 1, a(n) = -Sum_{d|n, d<n} A353458(n/d) * a(d).
a(n) = A353458(A003961(n)).
For all n >= 1, a(A000040(n)) = ((-1)^n).
The sequence is multiplicative. Let p be a prime. If the number of primes <= p [A000720(p)] is even, then a(p^e) = 1. If the number of primes <= p is odd, then a(p) = -1 and a(p^e) = 0 if e > 1. - Sebastian Karlsson, Apr 21 2022
MATHEMATICA
f[p_, e_] := If[EvenQ[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) A353457(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 A353457(n): return prod(-int(e==1) for p, e in factorint(n).items() if primepi(p)&1) # Chai Wah Wu, Jan 05 2023
CROSSREFS
Cf. A000040, A003961, A000720, A064989, A353458 [Dirichlet inverse, also a(A064989(n))], A353459 [sum with it].
Cf. also A353467.
Sequence in context: A359543 A361121 A371087 * A112299 A358839 A230901
KEYWORD
sign,mult
AUTHOR
Antti Karttunen, Apr 21 2022
STATUS
approved