public static void main(String[] args) {
		// Using Sieve of Eratosthenes to mark all primes below 2,000,000
		boolean[] nums = new boolean[2000000];
		long sum = 0;
		for (int i = 2; i < nums.length; i++)
			nums[i] = true;
		int nextPrime = 2;
		while (nextPrime < nums.length) {
			int i = nextPrime;
			sum += nextPrime;
			for (; i < nums.length; i += nextPrime)
				nums[i] = false;
			nums[nextPrime] = true;
			for (int j = nextPrime + 1; j < nums.length; j++) {
				if (nums[j] == true) {
					nextPrime = j;
					break;
				}
				nextPrime = 2000000;
			}
		}
		System.out.println(sum);
		// Solution: 142913828922
	}