login
A356018
a(n) is the number of evil divisors (A001969) of n.
8
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, 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, 2, 2, 1, 8, 0, 0, 4, 0, 1, 4, 0, 5, 3, 0, 1, 3, 3, 2
OFFSET
1,6
COMMENTS
a(n) = 0 iff n is in A093696.
FORMULA
a(n) = A000005(n) - A227872(n).
EXAMPLE
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.
MAPLE
A356018 := proc(n)
local a, d ;
a := 0 ;
for d in numtheory[divisors](n) do
if isA001969(d) then
a := a+1 ;
end if;
end do:
a ;
end proc:
seq(A356018(n), n=1..200) ; # R. J. Mathar, Aug 07 2022
MATHEMATICA
a[n_] := DivisorSum[n, 1 &, EvenQ[DigitCount[#, 2, 1]] &]; Array[a, 100] (* Amiram Eldar, Jul 23 2022 *)
PROG
(Python)
from sympy import divisors
def c(n): return bin(n).count("1")&1 == 0
def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Jul 23 2022
(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
CROSSREFS
Cf. A000005, A001969, A093688, A093696 (location of 0s), A227872, A356019, A356020.
Similar sequences: A083230, A087990, A087991, A332268, A355302.
Sequence in context: A275966 A284059 A329767 * A107502 A230419 A146165
KEYWORD
nonn,easy,base
AUTHOR
Bernard Schott, Jul 23 2022
EXTENSIONS
More terms from David A. Corneth, Jul 23 2022
STATUS
approved