HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Recursion > problem:


50577 - Perfect Numbers and Perfect Cousins

Guest
• Review clarifications (1)

Section problems

• 50415 - The Scientist
• 50421 - Repairing road segments
• 50935 - Max Discount
• 50724 - Number of Circles
• 50729 - Max number in 2D array
• 51081 - Fish Pond I
• 50726 - Pascal Triangle - 1
• 50928 - War Of Battleships
• 50577 - Perfect Numbers and P...
• 50721 - Palindrome

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
From USACO.

Perfect Numbers

Shqip
Perfect number is a number whose sum of divisors are equal to the number itself.
e.g. 6 is a perfect number because sum of its divisors is 1+2+3=6.
And, 220 and 284 are Perfect number cousins. Because the sum of the divisors of 220 is 284 and the sum of divisors of 284 is 220. Thus, they are called as Perfect number cousins.

Write a program that reads two numbers and finds out the perfect numbers and perfect number cousins between the given numbers.

Input specification
There will be two numbers (n and m) in one line seperated by a space where 1 < n < m ≤ 10000.

Output specification
Starting from the smallest one, list every perfect number in a line. if there are perfect number cousins, list them in the same line.
If there is no perfect number or perfect number cousins between the given numbers, then, show "0" (zero) which means there is no perfect number between the given numbers.

Input I
5 30
Output 1
6
28
     
Input 2
20 500
Output 2
28
220 284
284 220
496

Для отправки решений необходимо выполнить вход.

www.contester.ru