[Math] the probability that the number $3^a+7^b$ has a digit equal to $8$ at the units place

number theoryprobability

The number $a$ is randomly selected from the set $\left\{0,1,2,3,….,98,99\right\}$.The number $b$ is selected from the same set.What is the probability that the number $3^a+7^b$ has a digit equal to $8$ at the units place?


I only know this much that $3^a+7^b(mod 10)=8$.When $3^a+7^b$ is divided by $10$,its remainder is $8$ because its unit place is $1.$Total number of cases$=100\times 100$,but i cannot count favorable number of cases.Hence could not find the probability.Please help me.Thanks.

Best Answer

Use the Chinese theorem. $\equiv 8\pmod{10}$ means even and $\equiv 3\pmod{5}$. Now both $3$ and $7\equiv 2$ are generators for $\mathbb{F}_5^*$, hence the working cases are $a\equiv 2\pmod{4}$ and $b\equiv 2\pmod{4}$, $a\equiv 3\pmod{4}$ and $b\equiv 0\pmod{4}$, $a\equiv 0\pmod{4}$ and $b\equiv 1\pmod{4}$. $3^a$ and $7^b$ are always odd, hence $3^a+7^b$ is always $\equiv 0\pmod{2}$. Since the residue classes $\pmod{4}$ are equidistributed in $\{0,1,2,\ldots,98,99\}$, the wanted probability is: $$ \frac{3\cdot 25\cdot 25}{100\cdot 100}=\color{red}{\frac{3}{16}}.$$