Input two numbers to check if they are friendly numbers.
Friendly numbers** are pairs of positive integers \( A \) and \( B \) where the ratio of the sum of their divisors to the number itself is the same. Mathematically, this relationship is expressed as: \( \frac{S(A)}{A} = \frac{S(B)}{B} \) Here, \( S(n) \) represents the sum of all positive divisors of \( n \), including \( n \) itself.
Solution:
Divisors of 6: \( 1, 2, 3, 6 \); \( S(6) = 12 \).
Divisors of 28: \( 1, 2, 4, 7, 14, 28 \); \( S(28) = 56 \).
Compute the ratios:
\(\frac{S(6)}{6} = \frac{12}{6} = 2\)
\(\frac{S(28)}{28} = \frac{56}{28} = 2\)
Result: Since the ratios are equal, 6 and 28 are friendly numbers.
Solution:
Divisors of 10: \( 1, 2, 5, 10 \); \( S(10) = 18 \).
Divisors of 20: \( 1, 2, 4, 5, 10, 20 \); \( S(20) = 42 \).
Compute the ratios:
\(\frac{S(10)}{10} = \frac{18}{10} = 1.8\)
\(\frac{S(20)}{20} = \frac{42}{20} = 2.1\)
Result: Since the ratios are not equal, 10 and 20 are not friendly numbers.