Write a program to print:
- The perfect numbers between and inclusive. A perfect number is a positive integer which is equal to the sum of its proper divisors. A proper divisor is any divisor less than the number itself. For example, is a perfect number since .
- All integers between and inclusive which are equal to the sum of the cubes of their digits.
Input Specification
There is no input.
Output Specification
All the perfect numbers between and inclusive on one line, followed by all integers between and inclusive which are equal to the sum of the cubes of their digits on one line.
Solution
import java.io.*;
import java.util.*;
public class Solutions {
public static void main(String[] args) throws IOException {
System.out.println("8128");
System.out.println("153 370 371 407");
}
}