P1851 Good Friends
Background
Xiao Keke and all other classmates wear a radio-frequency identification (RFID) serial number tag on their wrists, so the teacher can easily count them. Many students have a "Good Friend". If the sum of the proper divisors of $A$ happens to equal the serial number of $B$, then $B$ is the "Good Friend" of $A$. Here, a number’s divisors do not include the number itself. Some students have no "Good Friend" because the sum of the divisors of their number is greater than every other student’s number. Some students have a "Very Good Friend". When two students are mutual "Good Friends", they form a pair of "Very Good Friends". Note that in this problem, we ignore cases where someone is their own "Very Good Friend".
Description
Given a serial number $s$, find the first pair of "Very Good Friends" such that the first serial number is not less than $s$.
Input Format
A single line containing one integer $s$, the given lower bound of the serial number.
Output Format
Output one line with two integers $a$ and $b$.
$a$ denotes the first student with a serial number not less than $s$ who has a "Very Good Friend", and $b$ is the "Very Good Friend" of $a$. (Note: $b
Explanation/Hint
Constraints
- For $100\%$ of the testdata, it is guaranteed that $6\le s\le1.8\times10^4$.
Translated by ChatGPT 5