// No.312 置換処理 // https://yukicoder.me/problems/no/312 // #include #include #include #include #include using namespace std; long long int solve(long long int N); vector calc_divisor(long long int n); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); long long N; cin >> N; long long ans = solve(N); cout << ans << endl; } long long int solve(long long int N) { vector divisors = calc_divisor(N); sort(divisors.begin(), divisors.end()); for (auto d: divisors) { if (d > 2) return d; } return N; } vector calc_divisor(long long int n) { vector ans; for (long long i = 1; i * i <= n; ++i) { if (n % i == 0) { ans.push_back(i); if (n / i != i) ans.push_back(n / i); } } return ans; }