Niloo Rad wrote:something is wrong with my code and i can't figure it out! will you help me to find it?
Well, you haven't given us all of it. Where is MAX_PRIME defined? Without that and your
isPrime() method, it's a bit tough to work out exactly what's wrong.
However, there is one simple optimization: you DON'T have to check every number.
In fact, (tip) ALL primes greater than 3 are equal to 6k ± 1, where k is a positive integer.
Winston