Thread: Power number
View Single Post
Old 2020-08-01, 17:51   #2
axn
 
axn's Avatar
 
Jun 2003

5×23×41 Posts
Default

Quote:
Originally Posted by Citrix View Post
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.
axn is offline   Reply With Quote