Quote:
Originally Posted by Citrix
Brute force could be one way:- calculating N%b, N%b^2 ... and checking if they are all same.
|
You have to start with b^k > |c| and check both N%b^k and N%b^(k+1) are the same. Of course, without any size limits on b or c, this is going to take forever to rule out all potential b's.
If b & c can be reasonably limited (say both < 1e9), you can use sieving techniques to quickly figure out valid (b,c) combinations that can potentially equal N.