#include using namespace std; #include using namespace atcoder; using mint = modint998244353; using ll = long long; vector is_prime; vector Q_enum; vector> POW; unordered_map ID; vector DI; void enum_prime(ll N) { ll sq = sqrt(N); POW.resize(sq + 1); is_prime.assign(sq + 1, 1); is_prime[0] = is_prime[1] = 0; for (ll i = 0; i <= sq; i++) { if (is_prime[i]) { for (ll j = i * 2; j <= sq; j += i)is_prime[j] = 0; ll r = 1; int s = 0; while (r <= N) { s += (r % 3); POW[i].push_back(s % 3); r *= i; } } } return; } vector sm, bg; void calc_Qenum(ll N) { ll sq = sqrt(N); sm.assign(sq + 100, -1); bg.assign(sq + 100, -1); for (int i = 1; i <= sq; i++) { Q_enum.emplace_back(N / i); ID[N / i] = ID.size(); DI.push_back(N / i); } while (Q_enum.back() > 1) { ID[Q_enum.back() - 1] = ID.size(); DI.push_back(Q_enum.back() - 1); Q_enum.emplace_back(Q_enum.back() - 1); } for (int i = 0; i < Q_enum.size(); i++) { ll n = Q_enum[i]; if (n < sm.size())sm[n] = i; if (N / n < bg.size())bg[N / n] = i; } return; } ll A, B; mint sum_n(ll n, ll c) { if (c == 1) { return (n + 2) / 3 - 1; } if (c == 2)return (n + 1) / 3; else if (c == 0)return n / 3; return 1; } vector calc_Fprime(ll N) { ll sq = sqrt(N); int sz = Q_enum.size(); vector F_pr(sz); for (int j = 0; j < sz; j++) { F_pr[j] = DI[j] - 1; } for (ll x = 2; x <= sq; x++) { if (is_prime[x]) { int y = (x - 1 < sm.size() ? sm[x - 1] : bg[N / (x - 1)]); for (int j = 0; j < sz; j++) { ll n = Q_enum[j]; if (n < x * x)break; int u = (n / x < sm.size() ? sm[n / x] : bg[N / (n / x)]); if (Q_enum[u] != n / x) { cout << n << " " << x << " " << sq << " " << u<<" "< INV(100, 1); //f(p^e) auto g_calc = [](ll p, ll e) { return INV[e + 1]; }; vector Min_sieve(ll N, function fn, vector F_pr) { int sz = Q_enum.size(); vector L_DP(sz); for (int i = 0; i < sz; i++)L_DP[i] = F_pr[i]; ll sq = sqrt(N); for (ll x = sq; x > 1; x--) { if (is_prime[x]) { int y = (x < sm.size() ? sm[x] : bg[N / (x)]);; for (int i = 0; i < sz; i++) { ll n = Q_enum[i]; if (n < x * x)break; ll cnt = 1; for (ll c = x; c * x <= n; c *= x) { int id = (n / c < sm.size() ? sm[n / c] : bg[N / (n / c)]); L_DP[i] += fn(x, cnt) * (L_DP[id] - F_pr[y]) + fn(x, cnt + 1); cnt++; } } } } return L_DP; } void solve() { ll N, M; cin >> N >> M; swap(N, M); for (int i = 1; i < 100; i++) { INV[i] = mint(i).pow(M); } Q_enum.clear(); ID.clear(); DI.clear(); calc_Qenum(N); ll sq = sqrt(N); // for(int i=0;i FP = calc_Fprime(N); for (auto& p : FP)p *= INV[2]; vector G_DP = Min_sieve(N, g_calc, FP); cout << (G_DP[ID[N]] + 1).val() << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); enum_prime(1e11 + 1); solve(); }