import java.util.Scanner; import java.util.ArrayList; import java.util.Collections; public class Main { public static ArrayList<Integer> list = new ArrayList<>(50); public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); scanner.close(); for (int i = 2; i < n; i++) { f(i); } } public static void f(int x) { int sum = 1; list.clear(); for(int i = 2; i <= Math.sqrt(x); i++) { if (x % i == 0) { sum += i + x / i; list.add(i); list.add(x / i); } } if (sum == x) { Collections.sort(list); System.out.print(x + " its factors are 1"); for(Integer e : list) { System.out.print(" " + e); } System.out.println(); } } }
0.0分
0 人评分