Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/funksiya-dost-sonlar

Amicable numbers

Medium 2000 ms 128 MB 50%
Share

Write a function AreAmicable(a, b) that returns true if the positive integers $a$ and $b$ are amicable and false otherwise. Two different numbers are amicable if, for each of them, the sum of its positive divisors smaller than itself equals the other number.

Example 1: AreAmicable(220, 284) → true — the divisors of $220$: $1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284$, of $284$: $1 + 2 + 4 + 71 + 142 = 220$.

Example 2: AreAmicable(10, 8) → false — the divisors of $10$: $1 + 2 + 5 = 8$, but of $8$: $1 + 2 + 4 = 7$.

Write only the function body.

Two numbers go into the function AreAmicable, which returns true or false

Input

One line with two positive integers $a$ and $b$ — the arguments of the function.

Output

The value returned by the function: true or false.

Note

$1 \le a, b \le 10^{6}$

Examples

Input #1
220 284
Output #1
true
Input #2
10 8
Output #2
false

Sign in to submit a solution

Signing up is free and takes a minute.