# What's The error in my code? (PRIME1)

I am a newbie to competitive programming . Can you guys please debug my code for the problem PRIME1 and tell me what’s the issue ? It’s giving correct ans for the custom inputs and default test cases
https://codeshare.io/mycode

Problem -->https://www.codechef.com/problems/PRIME1

1 Like

Hey @lordninja_1997, you can read this solution if you are stuck.

Hope you may get a little hint.

Consider the test case
1
10 20

@sagars21 You should really see the problem statement, it’s not asking about printing the number which has prime number of set-bits rather it’s asking for number of primes in the given range [L, R] with as constraint 1 \leq (R - L) \leq 10^{5}.

@lordninja_1997 You need to use an updated version of Sieve of Eratosthenes known as Segemented Sieve.
Refer to the links for understanding Segmented Sieve:

Meanwhile I will update the post with my solution.