P2398 GCD SUM
Description
Compute
$$\sum_{i=1}^n \sum_{j=1}^n \gcd(i, j)$$.
Input Format
The first line contains an integer $n$.
Output Format
Output a single integer on the first line representing the answer.
Explanation/Hint
For 30% of the testdata, $n \leq 3000$.
For 60% of the testdata, $7000 \leq n \leq 7100$.
For 100% of the testdata, $n \leq 10^5$.
Translated by ChatGPT 5