I am using the logic to deduce if a number is prime or not as follows: I am checking the number from 3 up to Ceil(Sqrt(num)) to see if the number is divisible by any integer in between. However, the first test case in Prateek loves candy problem is giving time limit exceeded error.
How should I proceed? What other faster way can I use to know if a number is prime or not?