1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// @Title: 二进制表示中质数个计算置位 (Prime Number of Set Bits in Binary Representation)
// @Author: 15816537946@163.com
// @Date: 2022-04-05 09:16:17
// @Runtime: 0 ms
// @Memory: 1.8 MB
func countPrimeSetBits(left, right int) (ans int) {
    for x := left; x <= right; x++ {
        if 1<<bits.OnesCount(uint(x))&665772 != 0 {
            ans++
        }
    }
    return
}