解方程
∑ d ∣ n f ( d ) σ p ( n d ) = σ q ( n ) f ∗ σ p = σ q 有 σ k = ∑ d ∣ n d k = i d k ∗ I f ∗ i d p ∗ I = i d q ∗ I ∑ d ∣ n μ ( d ) = μ ∗ I 对 上 面 式 子 同 时 卷 上 一 个 μ f ∗ i d p = i d q 因 为 i d k 是 一 个 完 全 积 性 函 数 , 所 以 i d p − 1 = μ × i d p i d k ∗ ( μ × i d p ) = ∑ d ∣ n d k × μ ( n d ) × ( n d ) k = ∑ d ∣ n μ ( d ) = ϵ f = i d q ∗ ( μ × i d p ) f ( n ) = ∑ d ∣ n μ ( d ) × d p × ( n d ) q f ( 1 ) = 1 f ( n ) = n q − n p ( n ∈ p r i m e s ) f ( a b ) = f ( a ) × f ( b ) ( g c d ( a , b ) = 1 ) f ( n x ) = n q − n p n ( x − 1 ) q = n x q − n p + ( x − 1 ) q ( n ∈ p r i m e s ) 然 后 就 可 以 线 性 筛 了 \sum_{d \mid n} f(d) \sigma_{p}(\frac{n}{d}) = \sigma_{q}(n)\\ f * \sigma_{p} = \sigma_{q}\\ 有\sigma_{k} = \sum_{d \mid n} d ^{k} = id_{k} * I\\ f * id_{p} * I = id_{q} * I\\ \sum_{d \mid n} \mu(d) = \mu * I\\ 对上面式子同时卷上一个\mu\\ f * id_{p} = id_{q}\\ 因为id_{k}是一个完全积性函数,所以id_{p} ^{-1} = \mu \times id_{p}\\ id_{k} * (\mu \times id_{p}) = \sum_{d \mid n} d ^k \times \mu(\frac{n}{d}) \times (\frac{n}{d}) ^k = \sum_{d \mid n} \mu(d) = \epsilon\\ f = id_{q} * (\mu \times id_{p})\\ f(n) = \sum_{d \mid n} \mu(d) \times d ^ p \times (\frac{n}{d}) ^{q}\\ f(1) = 1\\ f(n) = n ^ q - n ^ p(n \in primes)\\ f(ab) = f(a) \times f(b) (gcd(a, b) = 1)\\ f(n ^ x) = n ^ q - n ^ p n ^{(x - 1)q} = n ^ {xq} - n ^{p + (x - 1) q} (n \in primes)\\ 然后就可以线性筛了\\ d∣n∑f(d)σp(dn)=σq(n)f∗σp=σq有σk=d∣n∑dk=idk∗If∗idp∗I=idq∗Id∣n∑μ(d)=μ∗I对上面式子同时卷上一个μf∗idp=idq因为idk是一个完全积性函数,所以idp−1=μ×idpidk∗(μ×idp)=d∣n∑dk×μ(dn)×(dn)k=d∣n∑μ(d)=ϵf=idq∗(μ×idp)f(n)=d∣n∑μ(d)×dp×(dn)qf(1)=1f(n)=nq−np(n∈primes)f(ab)=f(a)×f(b)(gcd(a,b)=1)f(nx)=nq−npn(x−1)q=nxq−np+(x−1)q(n∈primes)然后就可以线性筛了
/*
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;
}