import java.util.Scanner;
public class test {
public static void main(String[] args) {
/*
* Scanner reader=new Scanner(System.in);
* System.out.println("请输入求指定范围内的完全数,第一个数小于第二个数:"); int
* x=reader.nextInt(); int y=reader.nextInt();
*/
int flag1;
int flag2;
for (int i = 1; i <=9999; i++) {
flag1=f(i);
for (int j = i + 1; j <=9999; j++) {
flag2=f(j);
if(i==flag2){
if(j==flag1){
System.out.println("符合条件的相亲数:"+i+" "+j);
}
}
}
}
}
public static int f(int n) {
int sum;
int m = n;
int b = (int) Math.sqrt(m);
sum = 1;
if (b> 1) {
if (b * b == m) {
for (int i = 2; i < b; i++) {
if (m % i == 0) {
sum = sum + i;
sum = sum + m / i;
}
}
sum = sum + b;
} else {
for (int i = 2; i < b+1; i++) {
if (m % i == 0) {
sum = sum + i;
sum = sum + m / i;
}
}
}
}
return sum;
}
}