Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #26 Oct 23 2023 02:01:44
%S 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,
%T 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,
%U -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
%N a(1) = 1, for n > 1, a(n) = -Sum_{d|n, d<n} a(A064989(n/d)) * a(d).
%H Antti Karttunen, <a href="/A353457/b353457.txt">Table of n, a(n) for n = 1..65537</a>
%H <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>.
%F a(1) = 1, for n > 1, a(n) = -Sum_{d|n, d<n} A353458(n/d) * a(d).
%F a(n) = A353458(A003961(n)).
%F For all n >= 1, a(A000040(n)) = ((-1)^n).
%F 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
%t 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 *)
%o (PARI)
%o A000265(n) = (n>>valuation(n,2));
%o A064989(n) = { my(f=factor(A000265(n))); for(i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f); };
%o memoA353457 = Map();
%o 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)));
%o (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)
%o (Python)
%o from math import prod
%o from sympy import primepi, factorint
%o 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
%Y Cf. A000040, A003961, A000720, A064989, A353458 [Dirichlet inverse, also a(A064989(n))], A353459 [sum with it].
%Y Cf. also A353467.
%K sign,mult
%O 1
%A _Antti Karttunen_, Apr 21 2022