At Last, Coprime
Time limit5sMemory limit1024 MB
Given N up to 10^11, sum i+j over all pairs (i, j) with 1 to N that are coprime, and output the result modulo 10^9+7.
- Level
Hard8 of 10
- Topics
- Math, Number theory, Divide and conquer
- Solved
- No attempts yet
Problem
Given a positive integer .
For every pair of positive integers with both components at most and , add the sum of its components. Compute the value of the expression below.
is the Indicator Function, which returns when is true and otherwise.
Input
The first line contains an integer .
Output
Print the total of the component sums over all coprime pairs, which is the value of the expression above. Since the answer can be very large, print the remainder when it is divided by .