代码:
```cpp
#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
return !b? a:gcd(b, a % b);
}
int main(){
int n;
while(scanf("%d", &n) == 1 && n){
int ans = 0;
for(int i = 1; i < n; i ++)
for(int j = i + 1; j <= n; j ++)
ans += gcd(i, j);
printf("%d\n", ans);
}
return 0;
}
、、、
```
by lahlah @ 2018-11-06 19:21:34
这题数据很弱啊(那为什么它难度竟然比P2398还高...)
by StudyingFather @ 2018-11-06 19:26:18
~~你这讨论使得又有人去水题了,,,就不能放过莫比乌斯反演么QAQ~~
by _Violet_ @ 2018-11-06 19:26:33
哪那么麻烦啊@[lahlah](/space/show?uid=31656)
```cpp
#include<cstdio>
int main()
{
printf("67\n13015\n442011");
return 0;
}
```
by vocaloid @ 2019-01-01 22:02:52
【超级滑稽】
by vocaloid @ 2019-01-01 22:02:59
@[Vocaloid](/space/show?uid=52734) 666
by lahlah @ 2019-01-02 07:05:59