#include #include #include using namespace std; typedef long long LL; //快读 int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); } return x * f; } const int N = 1010; //筛法求欧拉函数 int primes[N], cnt; bool st[N]; int phi[N]; LL s[N]; void euler(int n) { phi[1] = 1; for (int i = 2; i <= n; i++) { if (!st[i]) { primes[cnt++] = i; phi[i] = i - 1; } for (int j = 0; primes[j] * i <= n; j++) { st[i * primes[j]] = true; if (i % primes[j] == 0) { phi[i * primes[j]] = phi[i] * primes[j]; break; } phi[i * primes[j]] = phi[i] * (primes[j] - 1); } } } int main() { //欧拉函数筛 euler(N - 1); //这里注意一下是N-1,防止数组越界 //前缀和优化 for (int i = 1; i < N; i++) s[i] = s[i - 1] + phi[i]; int n, m = read(); for (int i = 1; i <= m; i++) { n = read(); printf("%d %d %d\n", i, n, s[n] * 2 + 1); } return 0; }