%I #28 Aug 07 2022 08:39:19
%S 0,0,1,0,1,2,0,0,2,2,0,3,0,0,3,0,1,4,0,3,1,0,1,4,1,0,3,0,1,6,0,0,2,2,
%T 1,6,0,0,2,4,0,2,1,0,5,2,0,5,0,2,3,0,1,6,1,0,2,2,0,9,0,0,3,0,2,4,0,3,
%U 2,2,1,8,0,0,4,0,1,4,0,5,3,0,1,3,3,2
%N a(n) is the number of evil divisors (A001969) of n.
%C a(n) = 0 iff n is in A093696.
%F a(n) = A000005(n) - A227872(n).
%e 12 has 6 divisors: {1, 2, 3, 4, 6, 12} of which three {3, 6, 12} have an even number of 1's in their binary expansion with 11, 110 and 11100 respectively; hence a(12) = 3.
%p A356018 := proc(n)
%p local a,d ;
%p a := 0 ;
%p for d in numtheory[divisors](n) do
%p if isA001969(d) then
%p a := a+1 ;
%p end if;
%p end do:
%p a ;
%p end proc:
%p seq(A356018(n),n=1..200) ; # _R. J. Mathar_, Aug 07 2022
%t a[n_] := DivisorSum[n, 1 &, EvenQ[DigitCount[#, 2, 1]] &]; Array[a, 100] (* _Amiram Eldar_, Jul 23 2022 *)
%o (Python)
%o from sympy import divisors
%o def c(n): return bin(n).count("1")&1 == 0
%o def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
%o print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Jul 23 2022
%o (PARI) a(n) = my(v = valuation(n, 2)); n>>=v; d=divisors(n); sum(i=1, #d, bitand(hammingweight(d[i]), 1) == 0) * (v+1) \\ _David A. Corneth_, Jul 23 2022
%Y Cf. A000005, A001969, A093688, A093696 (location of 0s), A227872, A356019, A356020.
%Y Similar sequences: A083230, A087990, A087991, A332268, A355302.
%K nonn,easy,base
%O 1,6
%A _Bernard Schott_, Jul 23 2022
%E More terms from _David A. Corneth_, Jul 23 2022
|