CitadelOA #10
Checksum Aggregation
Estimated HardJudge-ready
Topics (AI-labelled)Bits & Math
Packets are numbered 1..n, and C(i,j)=i mod j+j mod i. Find the sum of C over all ordered pairs modulo 1000000007. The diagonal terms are 0, so it makes no difference whether the pairs must consist of distinct packets.
Input
One line containing n; complete OCR bound 1≤n≤1000000.
Output
Output a single integer, the answer.
Example 1
Input:
2
Output:
2
Example 2
Input:
3
Output:
10
Example 3
Input:
4
Output:
24
Example notes
The outputs of the three public examples are, in order: 2; 10; 24. These answers were verified by independent enumeration or direct simulation.
Editorial
Loading solution…