Numbers ending with 0 [duplicate]

$2n$ ends with $0$ if $n$ ends with $0$. So how can we know if 2n ended with 0 in the first place?

-

marked as duplicate by Jim, Amzoti, Thomas, Ittay Weiss, PotatoMar 21 '13 at 3:51

It's a good idea when you get answers that are helpful, to accept an answer. You can "accept" one answer per question (soon, with a little more reputation, you'll be able to "up-vote" as many answers as you'd like). To accept an answer, just click on the $\large \checkmark$ that appears to the left of the answer you'd like to accept. It's one way to say "thanks"! Plus, you get two reputation points for each answer you accept. – amWhy Mar 22 '13 at 2:43

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$$ $$=a_0^2+2a_0a_1b+b^2(a_2^2+2a_0a_1)+2b^3(a_0a_3+a_1a_2)+\cdots+a_r^2b^{2r}$$

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.

-