func countPrimeSetBits(left int, right int) (ans int) { primes := map[int]int{} for _, v := range []int{2, 3, 5, 7, 11, 13, 17, 19} { primes[v] = 1 } for i := left; i <= right; i++ { ans += primes[bits.OnesCount(uint(i))] } return }
We use cookies in order to offer you the most relevant information. See our Privacy Policy.