Algorithm for finding least $b$ such that $2^b \equiv 2^a \pmod{m}$ Let $n > 1$ be a positive integer. Are there any known algorithms for finding the smallest positive integer $b > 0$ such that
$$
2^b \equiv 2^a \pmod{n}
$$
for some integer $0 \le a < b$? How would one find such a $b$?
 A: First, to extend my comment, with Henning Makholm's Caveat, to a reduction:
We have
$$(*) \qquad\qquad2^a \equiv 2^b \text{ mod } n \Leftrightarrow 2^a(2^{b-a}-1) \equiv 0\text{ mod }n. $$
Write $n =2^k \cdot n'$ with $n'$ odd.
If $a \le k-1$, then $(*)$ has no solution with $b > a$.
If, on the other hand, $a\ge k$, then $(*)$ is equivalent to $2^{b-a} \equiv 1$ mod $n'$, i.e. we have to find the order of $2\in (\mathbb Z/n')^\times$.
Secondly, after this reduction, I am pretty sure there is no good algorithm for computing such an order in general. Namely, this is essentially the discrete logarithm problem. Compare e.g. Easy way to find the order of elements in a finite field and Finding the order of elements of a quotient ring. Of course one should first factor $n'$ into prime powers $n'= \prod_{p \vert n} p^{k_p}$, and in the case $n' = p^k$ one can use Fermat's little theorem to see the order should be a divisor of $p^{k-1}(p-1)$, etc. For small $n'$, then a smart-brute-force calculation will quickly give results.
But if $n'$ is, say, $2^{73567542844189849778256010093567127647}-1$, I think some people would give you real money if you have a good algorithm for that.
