luogu#P1851. 好朋友

好朋友

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 AA happens to equal the serial number of BB, then BB is the "Good Friend" of AA. 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".

Problem Description

Given a serial number ss, find the first pair of "Very Good Friends" such that the first serial number is not less than ss.

Input Format

A single line containing one integer ss, the given lower bound of the serial number.

Output Format

Output one line with two integers aa and bb.

aa denotes the first student with a serial number not less than ss who has a "Very Good Friend", and bb is the "Very Good Friend" of aa. (Note: b<sb<s is allowed.)

206

220 284

Hint

Constraints

  • For 100%100\% of the testdata, it is guaranteed that 6s1.8×1046\le s\le1.8\times10^4.

Translated by ChatGPT 5