Getting wa in guess the prime

I calculated all the prime factors of x^2-(x^2%p) then find a no such that all prime factors gives unique modulus but getting wa in half the test cases. Can someone spot the mistake?
Here’s solution link
https://www.codechef.com/viewsolution/25323965

Your Code Is Giving Wrong Output When Hidden Prime Number Is 17.Check It Your Self.
(100000^2)%17=2 , After Giving 2 As Input Your Code Prints 1 145 , So (145^2)%17=13
and When I Gave 13 As Input In Printed 2 2 . Which Should Be 2 17.

1 Like