algorithms.tutorialhorizon.com
Numbers with prime set bits in a given range using Sieve of Eratosthenes Algorithm | Algorithms
Objective: Given a range, find all the numbers in the range which has prime set bits using Sieve of Eratosthenes Algorithm. Earlier we had seen a similar problem -Numbers with prime set bits in a given range solved in the naive approach. in this algorithm, we will improve the time complexity using Sieve of Eratosthenes. Example: L = 4, R = 10 Output: 5 Explanation: 4 = 1 0 0 ( not prime) 5 = 1 0 1 (prime) 6 = 1 1 0 (prime) 7 = 1 1 1 (prime)