private long getNext() {
		boolean primeFound = false;

		if (numPrimesFound == 0) {
			primesFound.add(2l);
			maxPrimeFound = 2;
			numPrimesFound = 1;
			maxNumberSearched = 2;
			return (long) 2;
		}

		for (long i = maxNumberSearched+1; !primeFound; i++) {
			// test if i is prime
			// divide by all primes <= sqrt(i)
			// if one divides evenly, then i is composite
			// but if we get to sqrt, then i is prime
			boolean divisorFound = false;
			long stoppingPoint = ((long) Math.sqrt(i)) + 1;
			for (int k = 1; primesFound.get(k) < stoppingPoint; k++) {
				if (i % primesFound.get(k) == 0) {
					divisorFound = true;
					break;
				}
			}
			if (!divisorFound) {
				numPrimesFound += 1;
				primeFound = true;
				maxPrimeFound = i;
				primesFound.add(i);
			}
			maxNumberSearched += 1;
		}
		return primesFound.get(numPrimesFound);
	}