#include // cout, endl, cin #include #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower #include #include #include #include #include #include #include #include #include // #include #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define repl(i,l,r) for (int i = l; i < (int)(r); i++) #define all(a) a.begin(),a.end() #define Pii pair #define Pll pair #define INFi 1000000001 #define INFl 1000000000000000001 using namespace std; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template void printArray(vector&A){ for(T&a:A){ cout< void printArrayln(vector&A){ for(T&a:A){ cout< std::ostream &operator<<(std::ostream &out, const pair &A){ cout<<"{"< std::ostream &operator<<(std::ostream &out, const map &M){ for(const auto&A:M){ cout<<"{"< std::ostream &operator<<(std::ostream &out, const set &M){ cout<<"{"; for(const auto&A:M){ cout< std::ostream &operator<<(std::ostream &out, const multiset &M){ cout<<"{"; for(const auto&A:M){ cout< std::ostream &operator<<(std::ostream &out, const vector &A){ for(const T &a:A){ cout< void print(Head H, Tail... T) { cout << H << " "; print(T...); } template std::istream &operator>>(std::istream &in,vector&A){ for(T&a:A){ std::cin>>a; } return in; } // modint: mod 計算を int を扱うように扱える構造体 template struct Fp { long long val; constexpr Fp(long long v = 0) noexcept : val(v % MOD) { if (val < 0) val += MOD; } constexpr int getmod() { return MOD; } constexpr Fp operator - () const noexcept { return val ? MOD - val : 0; } constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; } constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; } constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; } constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; } constexpr Fp& operator += (const Fp& r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Fp& operator -= (const Fp& r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Fp& operator *= (const Fp& r) noexcept { val = val * r.val % MOD; return *this; } constexpr Fp& operator /= (const Fp& r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator == (const Fp& r) const noexcept { return this->val == r.val; } constexpr bool operator != (const Fp& r) const noexcept { return this->val != r.val; } friend constexpr ostream& operator << (ostream &os, const Fp& x) noexcept { return os << x.val; } friend constexpr Fp modpow(const Fp &a, long long n) noexcept { if (n == 0) return 1; auto t = modpow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; using mint = Fp<998244353>; int main(void){ std::cin.tie(0)->sync_with_stdio(0); int N;cin>>N; // Nの階乗に、それぞれの素因数がいくつ含まれているか vector cnt; vector numbers(N+1); rep1(i,N)numbers[i]=i; for(int i=2;i<=N;i++){ if(numbers[i]==1)continue; cnt.push_back(0); for(int j=i;j<=N;j+=i){ while(numbers[j]%i==0){ numbers[j]/=i; cnt.back()++; } } } int prev = -1; vector cnt2; vector num; for(auto&c:cnt){ if(c==prev){ cnt2.back()++; }else{ prev = c; cnt2.push_back(1); num.push_back(c); } } mint sum = 1; mint ans = 0; for(int i=1000000;i>=1;i--){ mint tmp = 1; rep(j, cnt2.size()){ if(num[j]/i==0)break; tmp *= modpow(mint(num[j]/i+1), cnt2[j]); } tmp -= sum; sum += tmp; ans += tmp * mint(i); } cout<