private static boolean isPrime(int x) {
	if (x <= 1 || (x != 2 && x % 2 == 0)) { return false; }
	boolean prime = true;
	int a = 3;
	while (prime && a*a <= x) {
	    if (x % a == 0) {
		prime = false;
	    } else {
		a++;
	    }
	}
	return prime;
    }