class Solution:
def countPrimeSetBits(self, left: int, right: int) -> int:
# your code here
result = 0
for i in range(left, right+1):
site_num = bin(i)[2:].count("1")
if site_num > 1:
for n in range(2, site_num):
if (site_num % n) == 0:
break
else:
result += 1
return result
def countPrimeSetBits(left: int, right: int) -> int:
res_list=[str(j).count('1') for j in [bin(i) for i in range(left,right+1)] if str(j).count('1')!=1]
n=len(res_list)
for k in range(len(res_list)):
for l in range(2,res_list[k]):
if res_list[k]%l==0:
n-=1
return n
assert countPrimeSetBits(6,10)==4
assert countPrimeSetBits(10,15)==5