Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define int long long
- using namespace std;
- int32_t main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int N;
- cin >> N;
- int ans = 0;
- const int mod = 1e9 + 7;
- for(int i = 2; i < N; ++i)
- for(int j = i + 1; j <= N; ++j)
- if(j % i) {
- int d = __gcd(i, j);
- ans = (ans + 2 * i * j % mod * d % mod) % mod;
- }
- cout << ans;
- }
Add Comment
Please, Sign In to add comment