Problem 10
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
JAVA:
public class P010 {
public static void main(String[] args){ long sum = 0; for(int i=2;i<2000000;i++){ if(isprime(i)){ sum+=i; } } System.out.print(sum); } public static boolean isprime(int n){ for(int i=2;i*i<=n;i++){ if(n%i==0){ return false; } } return true; }}