#include<iostream> #include<map> #include<vector> #include<algorithm> #define maxn 100010 #define maxm 200010 #define INF 1000000000 #define ll long long usingnamespacestd;
intgcd(int a, int b){ return b == 0 ? a : gcd(b, a % b); }
constint p = 998244353; ll pow_mod(ll x, ll n){ ll s = 1; for (; n; n >>= 1, x = x * x % p) if (n & 1) s = s * x % p; return s; }
int pri[maxn], cnt, phi[maxn]; bool isp[maxn]; vector<int> A[maxn]; voidinit_isp(int n){ phi[1] = 1; for (int i = 2; i <= n; ++i) { if (!isp[i]) pri[++cnt] = i, phi[i] = i - 1; for (int j = 1; j <= cnt && i * pri[j] <= n; ++j) { isp[i * pri[j]] = 1; if (i % pri[j] == 0) { phi[i * pri[j]] = phi[i] * pri[j]; break; } phi[i * pri[j]] = phi[i] * (pri[j] - 1); } } for (int i = 1; i <= n; ++i) for (int j = i; j <= n; j += i) A[j].push_back(i); }
int n, m, f[maxn]; ll ppow[maxn];
voidwork(){ cin >> n >> m; for (int i = 1; i <= n; ++i) f[i] = gcd(i, m); ppow[0] = 1; for (int i = 1; i <= n; ++i) ppow[i] = ppow[i - 1] * m % p; for (int n = 1; n <= ::n; ++n) { ll ans = 0; for (auto d : A[n]) ans = (ans + ppow[d] * f[n / d] % p * phi[n / d] % p) % p; cout << ans * pow_mod(1ll * n * m % p, p - 2) % p << " \n"[n == ::n]; } }