HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


165. 50577 - Perfect Numbers and Perfect Cousins

Guest
• Review clarifications (1)

Volume problems

• 030. 50576 - Number of Perfect nu...
• 050. 50510 - What floor are they?
• 050. 50566 - Grade Point Average (...
• 066. 50523 - Total Tax to Pay
• 070. 50534 - Top Trading Company
• 095. 50453 - The Cubic Difference
• 125. 50578 - Mersenne prime
• 132. 50474 - Sum of Two Primes
• 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
• 50307 - Palindromes
• 50305 - John's Tasks
• 002. 50428 - Three Times

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