Nice Editorial.
I didn't use Binary Search.
First crucial observation is that. Pi must be expressible only in form of Pi=p1^a . Second observation is that . Since they want number of divisors(a+1) to be odd. It follows then that a should be even. **It means that Pi needs to be perfect square.**
So, I sorted the Pi's .
And, tried to factorize only if its **perfect square**. And while factorizing ,I broke (stop) from the factorization as soon as I found out that it has more than one distinct prime divisor.
[code][1]
[1]: https://www.codechef.com/viewsolution/16277774
Execution time : 0.10 s (although vijju123's one is lot faster :P )