import java.util.Scanner; /** * 【查找组成一个偶数最接近的两个素数】 * */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int nextInt = sc.nextInt(); int half = nextInt / 2; if (isPrime(half) || half == 2) { System.out.println(half); System.out.println(half); return; } // 从中间向两边遍历查找 for (int i = half + 1, j = half - 1; i < nextInt; i++, j--) { if (isPrime(i) && isPrime(j) && (i + j) == nextInt) { System.out.println(j); System.out.println(i); break; } } } /** * 判断是否素数 * * @param num * @return */ public static boolean isPrime(int num) { double sqrt = Math.sqrt(num); for (int k = 2; k <= (int) sqrt + 1; k++) { if (num % k == 0) { return false; } } return true; } }