TITLE: The number $2^{29}$ has exactly $9$ distinct digits. Which digit is missing?
QUESTION [24 upvotes]: The number $2^{29}$ has exactly $9$ distinct digits. Which digit is missing?

I came across this question in a math competition and I am looking for how to solve this question without working it out manually. Thanks.

REPLY [2 votes]: Let the number $N$ be represented by $9$ digits $d_i$ for $i=0,\dots,8$ so that 
$$N = \sum_{i=0}^{8} d_i  10^i$$ 
We first notice that 
$$\sum_{i=0}^{8} d_i  10^i \equiv \sum_i d_i \pmod{9}$$
Since only one digit is missing, this sum must be between 36 (with 9 missing) and 45 (with 0 missing). There are two cases to consider.  Either $\sum d_i \equiv 0 \pmod{9}$ or it is not.  In the first case, either 0 or 9 is the missing digit, since those are the only missing values for which $\sum_i d_i \equiv 0 \pmod{9}$, making the sum either 36 or 45. We can determine which is the value by looking at the sum $\pmod{8} = N \pmod{8}$: if this value is 4 then the sum is 36 and 9 is the missing digit.  If $N \equiv 5 \pmod{8}$, then the sum is 45 and 0 is the missing digit.
In the second case, we note that the sum of all but one digit $x$ is congruent to $-x \pmod{9}$.  Solving this congruence for $x$ gives the missing digit.
This addresses the case of an arbitrary $N$ for which $N \equiv 0 \pmod{9}$ which the accepted answer does not handle correctly.  Since I'm not yet allowed to comment or improve other answers by censors, I just constructed a new, complete answer.  Vote it up so in the future I can do this the right way.