I know that to find the last digit of an integer $n$, we must compute $n(\operatorname*{mod} 10)$? But why does this work? How can we prove this?
Finding the last digit of an integer $n$
0
$\begingroup$
discrete-mathematics
modular-arithmetic
2 Answers
2
This works only in base $10$. In base $10$, the number $d_nd_{n-1}...d_1$ is by definition:
$$10^{n-1}d_n+10^{n-2}d_{n-1}+\cdots+10d_2+d_1$$
All terms are necessarily divisible by $10$ except for the last.
1
Think of it as finding the remainder on division by $10$. So $n= 10q+r$, and the $r$ is what we are interested in. Of course $10q$ ends in a zero, so doesn't affect the last digit.