Prime Set Bits

Count the numbers in the inclusive range [left, right] whose binary representation has a prime number of set bits (1 bits). A prime number is greater than 1 and has exactly two distinct divisors: 1 and itself. Return the total count.

Examples
Input: [6,10]
Output: 4
Hints

Prime Set Bits

Count the numbers in the inclusive range [left, right] whose binary representation has a prime number of set bits (1 bits). A prime number is greater than 1 and has exactly two distinct divisors: 1 and itself. Return the total count.