asked 19 Jul '14, 19:11

@michelangelo...i observed that if no. if a perfect square answer is yes. the only exception is the number 2.But it gives wrong answer answered 19 Jul '14, 20:04
36, 49, 81, and many more perfect squares do not satisfy that property. The trick is to reduce the solution space to perfect squares and then apply the given conditions to get the final solution. Of course, the exception being 2.
(19 Jul '14, 20:15)

but if i store all perfect squares and start finding their sum of divisors and then check if it is prime or not, it will give tle as the sum of divisors for 10^6 would be quite big. And i'll have to check if that no.. is prime which again will involve loping answered 19 Jul '14, 21:11

@aman2192 There is a pattern for the solution. Write the first few numbers that satisfy the given constraints and you'll be good to go.