解方程
/* Author : lifehappy */ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e7 + 10, mod = 998244353; ll prime[N], minnp[N], f[N], cnt, p, q, n; bool st[N]; ll quick_pow(ll a, int n) { ll ans = 1; while(n) { if(n & 1) ans = ans * a % mod; a = a * a % mod; n >>= 1; } return ans; } void init() { f[1] = 1; for(int i = 2; i < N; i++) { if(!st[i]) { prime[++cnt] = i; f[i] = (quick_pow(i, q) - quick_pow(i, p) + mod) % mod; minnp[i] = 1; } for(int j = 1; j <= cnt && 1ll * i * prime[j] < N; j++) { st[i * prime[j]] = 1; if(i % prime[j] == 0) { minnp[i * prime[j]] = minnp[i] + 1; f[i * prime[j]] = f[i / quick_pow(prime[j], minnp[i])] * (quick_pow(prime[j], q * (minnp[i * prime[j]])) - quick_pow(prime[j], p + minnp[i] * q) + mod) % mod; break; } minnp[i * prime[j]] = 1; f[i * prime[j]] = f[i] * f[prime[j]] % mod; } } } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n >> p >> q; init(); ll ans = 0; for(int i = 1; i <= n; i++) { ans ^= f[i]; } cout << ans << "\n"; return 0; }