Time limit: 2.0s
Memory limit: 16M
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL,
CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
Write a program to print:
- The perfect numbers between ~1\,000~ and ~9\,999~ 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, ~6~ is a perfect number since ~1 + 2 + 3 = 6~.
- All integers between ~100~ and ~999~ inclusive which are equal to the sum of the cubes of their digits.
There is no input.
All the perfect numbers between ~1\,000~ and ~9\,999~ inclusive on one line, followed by all integers between ~100~ and ~999~ inclusive which are equal to the sum of the cubes of their digits on one line.