Numbers ending with 0

This question already has an answer here:

  • $n^2$ for bases to prove that the last digit of base b ends with 0

    3 answers

Solutions Collecting From Web of "Numbers ending with 0"

Try squaring all the single digit numbers in each base. In some of them you will only find that $0^2$ ends in zero. In others you will find a non-zero number that has a square ending in zero. I would suggest you do bases 2 through 9, then think about what is special about the ones where you find a non-zero number with square ending in zero.

Hint: For $b=5$ we know a number ends in 0 when written in base 5 only when the number’s remainder when divided by 5 is 0.
Now when $b=5$ if $n^2$ has remainder 0 when divided by 5, must $n$?

What is special about 5 that makes this work?

For $b=9$, note that in base 9, $3^2=10$ for an easy counterexample. Some of these are easy if you consider the prime factors of $b$.

Let $n=a_0+a_1b+a_2b^2+\cdots+a_{r-1}b^{r-1}+a_rb^r$ in base $b$

So, $$n^2=(a_0+a_1b+a_2b^2+\cdots+a_{r-1}b^{r-1}+a_rb^r)^2$$

Now, $n^2$ and $n$ with end with same digit if $b$ divides $a_0^2-a_0=a_0(a_0-1)$

If $a_0=0, b$ always divides $a_0(a_0-1)$, hence $n^2$ will end with $0$ if $n$ ends with $0$

A little generalization :

Observe that $(a_0,a_0-1)=1$

If $b$ is prime like $5,7$ or power of prime like $2^3=8, 3^2=9$, so

either $b\mid a_0\implies a_0=0$ as $0\le a_0<b$

or $b\mid(a_0-1) \implies a_0=1$

If $b$ can be expressed as a product of two other numbers $p,q$ such that $p>q>1;(p,q)=1$ like $6$

either $(i)p\mid a_0, q\mid(a_0-1)$

or $(ii) q\mid a_0, p\mid(a_0-1)$

or $(iii) q\mid a_0(a_0-1)$

or $(ii) p\mid a_0(a_0-1)$

$(i),(ii)$ can be solved using CRT.