#include #include #include #include #include #include #include #include #include #include #include #include //#include "toollib.h" #define INT_MAX 2147483647 #define Loop(i, n) for(int i = 0; i < (int)n; i++) #pragma warning (disable:4018) using namespace std; typedef long long int lint; //***** Main Program ***** bool judge_prime_numbers(lint n) { if (n == 1) return false; if (n == 2) return true; else if (n % 2 == 0) return false; else { bool judge = true; for (lint i = 3; i <= sqrt(n); i = i + 2) { if (n%i == 0) { judge = false; break; } } return judge; } } int main() { lint N; cin >> N; if (N % 3 == 0) cout << 3 << endl; else if (N % 4 == 0) cout << 4 << endl; else if (judge_prime_numbers(N)) cout << N << endl; else if (N % 2 == 0 && judge_prime_numbers(N / 2)) cout << N/2 << endl; else { for (lint i = 5; i < N; i++) { if (judge_prime_numbers(i)) { if (N%i == 0) cout << i << endl; } } } return 0; }