#P2398. GCD SUM

    ID: 1395 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>数学枚举,暴力素数判断,质数,筛法

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. ```input1 2 ``` ```output1 5 ``` ## 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$$