#include using namespace std; void whosprime(long long x) { bool imPrime = true; for(int i = 1; i <= x; i++) { for(int z =
Simple way :
#include using namespace std; typedef long long int ll; ll largeFactor(ll n) { ll ma=0; for(ll i=2; i*i<=n; i++) { while(n%i == 0) { n=n/i; ma=i; } } ma = max(ma, n); return ma; } int main() { ll n; cin>>n; cout<
Implementation using prime sieve ideone.