$x$ is fixed odd positive integer value. $n$ and $w$ are fixed positive integer values. $a$ is positive integer value.
I am interested for $n=41$ and $w=160$, but would appreciate a general algorithm.
I know how to find any $a$ for which $a^n \equiv x \pmod{2^w}$. Algorithm requires $w$ steps:
- Let $a\leftarrow1$
- Iterate $i$ from 1 to $w-1$ and for each $i$ do:
- if $a^n \equiv x \mod(2^{i+1})$, do nothing.
- otherwise assign $a \leftarrow a+2^i$
Is this algorithm giving the smallest value $a$ for which $a^n \equiv x \pmod{2^w}$? How to find smallest $a$ for which $a^n \equiv x \pmod{2^w}$?