#include using namespace std; // 素因数分解を行い、(素因数, 指数)のペアを返す関数 vector> primeFactorization(int n) { vector> factors; // 2で割り切れる限り割る int count = 0; while (n % 2 == 0) { count++; n /= 2; } if (count > 0) { factors.push_back({2, count}); } // 3以上の奇数で割り切れる限り割る for (int i = 3; i * i <= n; i += 2) { count = 0; while (n % i == 0) { count++; n /= i; } if (count > 0) { factors.push_back({i, count}); } } // nが素数の場合(1より大きい) if (n > 1) { factors.push_back({n, 1}); } return factors; } int reconstructFromFactors(const vector>& factors) { int result = 1; for (const auto& factor : factors) { result *= (int)pow(factor.first, factor.second); } return result; } int computeTotient(int n, const vector>& factors) { double result = n; // 初期値をnに設定 for (const auto& factor : factors) { int p = factor.first; // 素因数 if(factor.second != 0){ result *= (1.0 - 1.0 / p); } } return static_cast(result); // 結果を整数に変換 } double fill_dp(const vector>& factors,vector dp){ int n = reconstructFromFactors(factors); if(dp[n] > -0.5){ return dp[n]; } int size = factors.size(); double sum_dp = 0.0; vector e(size,0); vector> k(size); vector> n_k(size); int k_num; e[0] = 1; while(e[size-1] <= factors[size-1].second){ for(int i=0;i factors[i].second){ e[i] = 0; e[i+1]++; } } } dp[n] = ((double)n + sum_dp)/((double)(n-1)); return dp[n]; } int main() { int N; cin >> N; vector> factors = primeFactorization(N); vector dp(N+1,-1.0); dp[1] = 1; cout << fill_dp(factors,dp) << endl; return 0; }