Exceeding time limit in 'Prateek Loves Candy' problem


sir in this code the fifth testcase is showing time limit error
please help

Hey @DJ20001 since the test cases can go upto 10000 iterating till the given n each time will exceed the time limit, we will get around this by creating an array such that Array[i] will correspond to the ith prime number and then we’ll be able to solve each test case in constant time.
Here is link of your code modified accordingly: https://ide.codingblocks.com/s/171642.
Let me know if you still face some problem.

Got it sir. Thank you!!