I\'m trying to find the sum of the prime numbers < 2,000,000. This is my solution in Java but I can\'t seem get the correct answer. Please give some input on what could b
You're treating as prime those numbers that are only divisible by their square root (like 25). Instead of i < Math.sqrt(nr) try i <= Math.sqrt(nr).
i < Math.sqrt(nr)
i <= Math.sqrt(nr)
That's a really inefficient way to find primes, incidentally.