std::bitset<1664513> v; int p[125641], mu[1664513]; phi[1664513]; std::unordered_map<unsigned, ll> mu_, phi_;
voidsieve(unsigned N); // 普通地线筛出 1~N 的 mu 和 phi 值
ll getMu(unsigned N){ if (N <= base) return mu[N]; if (mu_.count(N)) return mu_[N]; ll ans = 0; for (unsigned l = 2, r, L; l <= N; l = r + 1) { L = N / l, r = N / L; ans += (r - l + 1) * getMu(L); } return mu_[N] = 1ll - ans; }
ll getPhi(unsigned N){ if (N <= base) return phi[N]; if (phi_.count(N)) return phi_[N]; ll ans = 0; for (unsigned l = 2, r, L; l <= N; l = r + 1) { L = N / l, r = N / L; ans += (r - l + 1) * getPhi(L); } return phi_[N] = (1ull * N * (N + 1ull) >> 1) - ans; }
intgetMu(unsigned N){ if (N <= base) return mu[N]; if (vm[to(N)]) return mu_[to(N)]; int ans = 0; for (unsigned l = 2, r, L; l <= N; l = r + 1) { L = N / l, r = N / L; ans += (r - l + 1) * getMu(L); } vm.set(to(N)); return mu_[to(N)] = 1 - ans; }
ll getPhi(unsigned N){ if (N <= base) return phi[N]; if (vp[to(N)]) return phi_[to(N)]; ll ans = 0; for (unsigned l = 2, r, L; l <= N; l = r + 1) { L = N / l, r = N / L; ans += (r - l + 1) * getPhi(L); } vp.set(to(N)); return phi_[to(N)] = (1ull * N * (N + 1ull) >> 1) - ans; }
intmain(){ unsigned T, N;
sieve(base); for (std::cin >> T; T; --T) { vm.reset(), vp.reset();