/*
project euler problem 3: 找出 600851475143 的最大质因子。
answer: 6857
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(void)
{
LL num = 600851475143;
LL ans = 2;
for (LL i = 2; i * i < num; ++i)
{
while (num % i == 0)
{
ans = i;
num /= i;
}
}
if (num > 1) ans = num;
cout << ans << endl;
}