
Can someone take a look into my code and why does it fails on 18 and 20 test case on time ? when I test it home for limit number it work's fast ?
http://www.z-trening.com/new/www/html/submit.php?submit=7100054306&subm_code=1

As I can see your solution's complexity is f(n)=largest prime divisor of n,
so if n=p prime, then it takes O(n) time, too large!
You can factorize in O(sqrt(n)) time in every case. Use that.

I don't understand what are you meaning?

Solved please delete the topic...

http://www.z-trening.com/new/www/html/submit.php?subm_stat=1&submit=7100054585
what am i doing wrong ?

can anybody look at my code and write what am i doing wrong ?

Change 'IsP'. Try:
bool isP(lnt a){
int q = sqrt ( a );
for(lnt x=2;x<=q;++x){
if(a%x==0)return false;
}
return true;
}

that's the same thing,
x*x <= a , or x <= sqrt(a)

Try to do the same, without checking wheter the number is prime or not... :)

stil fails on time at 17. TC
http://www.z-trening.com/new/www/html/submit.php?subm_stat=1&submit=7100054767

You don't need isP() function, I think you can simply delete her... :)