code:
#include<bits/stdc++.h>
using namespace std;
#define NOC ios::sync_with_stdio(0);cin.tie();cout.tie();
typedef unsigned long long ull;
int main(){
NOC;
ull n;
cin>>n;
ull ans=0;
for(ull i=1;i<=n;i++)
{
for(ull j=i+1;j<=n;j++)
{
ans+=__gcd(i,j);
}
}
cout<<ans;
return 0;
}
验证码:wqpx