A356018 a(n) is the number of evil divisors (A001969) of n.
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
Examples
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.
Crossrefs
Programs
-
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 *)
-
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
-
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
Extensions
More terms from David A. Corneth, Jul 23 2022
Comments