Project Euler – Problem 27

Problem 27: Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n = 0 of the form: n² + an + b, where |a| 1000 and |b| 1000,

import java.util.Vector;

class runner
{
	static Vector primestorage = new Vector(); 
	private static boolean isPrime(int n){
		if(n < 2) return false;
		if(primestorage.contains(n)) return true;
		
		double sqr = Math.sqrt(n)+1;
		for(int i=2; i


Note: Negative primes were ignored which decreased the execution time.