/* -*- coding: utf-8 -*- * * 2552.cc: No.2552 Not Coprime, Not Divisor - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 1000000; /* typedef */ typedef long long ll; /* global variables */ int phis[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) phis[i] = i; for (int p = 2; p <= n; p++) if (phis[p] == p) { phis[p]--; for (int i = 2; i * p <= n; i++) phis[i * p] -= phis[i * p] / p; } ll sum = (ll)n * (n - 1) / 2; for (int x = 2; x <= n; x++) sum -= phis[x] + (n / x - 1); printf("%lld\n", sum); return 0; }