eolymp
bolt
Try our new interface for solving problems
Problems

Friendly numbers

Friendly numbers

Two different natural numbers are called friendly if the first one is the sum of divisors of the second number, with the exception of the second number, and the second is the sum of divisors of the first day, except for the very first day. Want to find all the pairs of friendly numbers, both of which belong to the interval from \textit{\textbf{M}} to \textit{\textbf{N}}. \InputFile In the first row are integers \textit{\textbf{M}} and \textit{\textbf{N}}\textit{ } (\textbf{1}  ≤ \textit{\textbf{M}}\textit{ } ≤ \textit{\textbf{N}}\textit{ } ≤ \textbf{1 000 000}). \OutputFile In each line of output from a pair of numbers separated by spaces. The first number pair must be less than the second. Rows must be sorted in ascending order of the first of the pair. If the pairs of friendly numbers in the interval not to withdraw "\textbf{Absent}".
Time limit 1 second
Memory limit 64 MiB
Input example #1
200 300
Output example #1
220 284

Example description: 220=1+2+4+71+142 (all divisors of 284); 284=1+2+4+5+10+11+20+22+44+55+110 (all divisors of 220).