#P1851. Find the First Amicable Pair Not Less Than s
Find the First Amicable Pair Not Less Than s
Find the First Amicable Pair Not Less Than s
Given an integer s, find the first amicable pair (a, b) such that a \ge s where amicable numbers are defined as follows:
An amicable pair \((a, b)\) satisfies:
$$\sigma(a) - a = b \quad \text{and} \quad \sigma(b) - b = a$$
where \(\sigma(n)\) denotes the sum of all positive divisors of \(n\) and \(a \neq b\). For example, the smallest amicable pair is \((220, 284)\) because:
- \(\sigma(220)-220 = 284\)
- \(\sigma(284)-284 = 220\)
Your task is to find and output the first amicable pair \((a, b)\) with \(a \ge s\).
inputFormat
The input consists of a single integer s (\(1 \le s \le 10^5\)).
outputFormat
Output two space-separated integers, \(a\) and \(b\), representing the first amicable pair with \(a \ge s\).
sample
200
220 284