Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.sf.cotelab.euler;
 
A solution for Project Euler Problem 10. The problem statement is here.

Author(s):
Al Cote'
public class Problem10 {

Parameters:
args unused.
	public static void main(String[] args) {
		Primes primes = new Primes();
		long sum = 0;
//		for (long candidate = 2; candidate < LIMIT; ++candidate) {
//			if (primes.isPrime(candidate)) {
//				sum += candidate;
//			}
//		}
		for (long p = .p < p = primes.nextPrime(p)) {
			sum += p;
		}
		// 142913828922
		..println("sum = " + sum);
	}
	public static long LIMIT = 2000000;
New to GrepCode? Check out our FAQ X