HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


165. 50577 - Perfect Numbers and Perfect Cousins

Guest
• Review clarifications (1)

Volume problems

• 132. 50474 - Sum of Two Primes
• 135. 50572 - Palindromic Numbers
• 140. 50393 - Palindromic Numbers
• 145. 50586 - Prime Palindromes
• 148. 50412 - K numbers
• 150. 50375 - Area of Circles
• 160. 50388 - Number of Armstrong ...
• 160. 50571 - Armstrong Numbers - 2
• 165. 50577 - Perfect Numbers ...
• 190. 50533 - Contacts List
• 200. 50454 - What day is it?
• 210. 50369 - Base Conversion
• 250. 50385 - The 3n + 1 problem
• 260. 50493 - n-digit kth Prime Number

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