Prime number or not in Pascal

https://www.codechef.com/COYH2017/problems/Q1_NU this is the question which was asked yesterday in a contest by niit university. My code is:
https://www.codechef.com/viewsolution/15687639
What is the error in this sum?I tried all variations probably but did not get AC.