Solution accepted in spoj but time limit exceed in codechef

I submitted my answer in SPOJ for PRIME1 Problem - CodeChef accepted with time 1.72. But I am getting TLE in codechef. My solution is CodeChef: Practical coding for everyone