Simpler way to compress this exponentiation?

57 Views Asked by At

I am trying to find when the following is true:

Let $H =(10k)^b \bmod 6(p-1)$

Let $J = 10^{H} \bmod 9p$

For some prime $p > 5$ and large $k,b$.

I am trying to find when $J$ is equal to $1$. However I have no idea how to even begin compressing this into something a little more palatable. Right now I am using binary exponentiation to compute $a^b \bmod m$ in general but I am wondering if there is a simpler way to determine when $J = 1$ (i.e. if there is some way to tell which combinations of variables will render this true).

Equivalently:

When does $10^{(10k)^b} \bmod 9p$ equal $1$?

1

There are 1 best solutions below

10
On

Since $\,10^H\equiv 1^H\equiv 1\pmod 9\,$ it suffices to verify that $\,10^H\equiv 1\pmod p,\ $ where we have $\,10^H\equiv 1\equiv 10^{\,p-1}$ $\iff$ $10^{(H,p-1)}\equiv 1.\,$ Therfore it suffices to check the smaller power $\,(H,p\!-\!1) = (H\ {\rm mod}\ p\!-\!1,\, p\!-\!1),\,$ which can be done by repeated squaring. That and the gcd and mod operations are all very fast.

There is no general formula to compute the answer - you will need to do some analogous computation. If you have further information available then the computation may be quicker, e.g. if you know that $\,10\,$ has order $\,n\,$ modulo $\,p\,$ then you need only test if $\,n\mid H.\,$ Thus if are performing many tests mod $\,p\,$ then it might be more efficient to first compute the order of $\,10.$ See here for order computation algorithms and complexity analysis.