low and high. How many numbers from low to high inclusive have a prime number of ones in their binary form?
For example, 13 = 1101₂ has three ones, and 3 is prime, so 13 counts.low=3, high=8 → 4
3 = 11₂ (2 ones), 4 = 100₂ (1), 5 = 101₂ (2), 6 = 110₂ (2), 7 = 111₂ (3), 8 = 1000₂ (1). The count is prime for 3, 5, 6 and 7, so the answer is 4.
low=16, high=16 → 0
16 = 10000₂ has a single one, and 1 is not prime.
low=1, high=31 → 21
low=3, high=8
4
Run checks the first 3 tests in your browser. Submit checks all 76 tests on the server, hidden ones included.