import java.util.Scanner; public class Main{ private static boolean isPrime(int x){ for(int i = 2;i<=x/2;i++){ if(x%i == 0){ return false; } } return true; } public static void main(String [] args){ Scanner sc = new Scanner(System.in); while(sc.has...