#pragma GCC optimize("Ofast") #include using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } inline double time() { return static_cast(chrono::duration_cast(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9; } typedef long double ld; ld Harmonic(ll n) { static vector dp; if (dp.empty()) { dp.resize(1000); for (int i = 1; i < 1000; ++i) { dp[i] = dp[i - 1] + ld(1) / i; } } if (n < 1000) return dp[n]; return logl(n) + 0.57721566490153286060651209 + ld(1) / (2LL * n) - ld(1) / 12 / n / n + ld(1) / 120 / n / n / n / n; } // {x,{l,r}} : n/i = x (l <= i <= r) を{l,r}の昇順に返す template vector>> quotient_range(T n) { vector>> res; T m = 1; while (m * m <= n) { res.push_back({n / m, {m, m}}); m += 1; } for (int i = m; i >= 1; --i) { T l = n / (i + 1) + 1; T r = n / i; if (l <= r and res.back().second.second < l) res.push_back({n / l, {l, r}}); } return res; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll n; cin >> n; auto q = quotient_range(n); ld res = 0; for (auto [x, lr] : q) { ld h1 = Harmonic(lr.second); ld h2 = Harmonic(lr.first - 1); ld hx = Harmonic(x); res += (h1 - h2) * hx; } cout << fixed << setprecision(10) << res << '\n'; }