Find the last non-zero digit of $30^{2345}$ 
Find the last non-zero digit of $30^{2345}$

Source: Athena Healthcare Interview Questions
 A: Hint: Powers of $3$ follow the last digit pattern $3,9,7,1,3,9,7,1,...$
A: $$\begin{split}
3^1&=3\\
3^2&=9\\
3^3&=27\\
3^4&=81\\
3^5&=243\\
&\dots
\end{split}
$$
As last digit is following a cycle of $4$ so $2345/4$ gives remainder as $1$ and $3^1=3$,
so the last non-zero digit is $3$.
A: Strictly speaking, the question is ill-defined because it doesn't give the base. For example, in base 2, the last nonzero digit of that number is 1 (the last non-zero digit of any non-zero number is 1 in base 2). :-)
However, let's assume base 10:
First, $30^{2345}=3^{2345}\cdot 10^{2345}$. Now $10^2345$ just adds zeroes at the end, therefore the last non-zero digit of $30^{2345}$ is the same as the last non-zero digit of $3^{2345}$.
Moreover, since $3$ is not a multiple of $10$, nor is $3^n$ for any $n$, and thus the lost non-zero digit
Next, we see that the last digit of $ab$ is the last digit of the product of the last digit of $a$ and the last digit of $b$, since if $a=10a_1 + a_0$ and $b=10b_1 + b_0$, then $ab = (10a_1+a_0)(10b_1+b_0) = 10(10a_1b_1 + a_0 b_1 + a_1 b_0) + a_0 b_0$.
Now we find that $3^4=81$, therefore a factor of $3^4$ does not change the last digit. Especially that means that the last digit of $3^{4n+k}$ is the same as the last digit of $3^k$.
Now it is not hard to check that $2344$ is a multiple of $4$, and thus the last digit of $3^{2345} = 3^{2344 + 1}$ is the last digit of $3^1=3$.
Determining the last digit of $3$ is left as exercise to the reader. :-)
