import java.util.Scanner; public class P_GoodPrimes { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("How many good primes do you want?"); int num = s.nextInt(); goodPrimes(num); //call goodPrimes with the number then provide } public static void goodPrimes(int n) { int count = 0; //this will count the number of "good primes" int num=1; //this is the number that I'm checking for good primes while(count < n) //keep going until I've found n Good primes { num++; //number keeps getting bigger by 1 if(isPrime(num) && isGood(num)) //is the number prime and good? { System.out.print(num +" "); //if so, output it count++; //and increase my count } } outputDifference(num); //output the difference between my last good prime and the goodPrime before it } public static boolean isPrime(int num) { if(num<2) return false; for (int x =2; x primeBefore * primeAfter; } }