1

$n(a) := 3 1 7 2 a 6 3 7 5$

What value needs a to be so that $9|n(a)$?

Is there a way to solve this fast? My initial idea was to write it as a sum like

$5 + 7 * 10 + 3 * 100 + 6 * 1000 + a * 10000 ... $

Because $a + c = b + d (\mod m )$

But this seems a bit time intensive and my professor just said the answer is trivial, it is 2. So I assume that I can somehow directly know that it is 2? How would I do that?

update:

$34 + a = 0(\mod 9)$

$34 \mod 9 = 7$

$b = a \mod 9$

The rests need to add up to 9, therefore

$7 + b = 0 (\mod 9)$

$b = 2$

Therefore a needs also to be 2.

1 Answers1

1

A number $n$ is divisible by $9$ if and only if the sum of the digits of $n$ is also divisible by $9$

(if and only if the sum of the digits of the sum of the digits of $n$ is also divisible by $9$) (if and only if the sum of the digits of the sum of the digits of the sum of the digits...)

E.g. $18324$ has sum of digits $1+8+3+2+4=18$ which is divisible by $9$ so $18324$ is also divisible by $9$.


As we desire $n(a)$ to be divisible by $9$, this will occur if and only if the sum of the digits is divisible by $9$.

$\iff$ $3+1+7+2+a+6+3+7+5\equiv 0\pmod{9}$

$\iff 34+a\equiv 0\pmod{9}$

$\iff a\equiv -34\pmod{9}$

$\iff a\equiv 2\pmod{9}$

As $2$ is the only digit which is equivalent to $2\pmod{9}$ it must be that $a=2$

Note: The final line is necessary as some other cases may yield multiple answers. If the number was instead $31\color{red}{9}2a6375$ we could have had $a=0$ or $a=9$


In a much more informal proof, one could "case out nines" very quickly. The $3$ and the $6$ will cancel, the $2$ and the $7$ will cancel. The $1,3,5$ together cancel, leaving you with two digits still needing to properly cancel one another: a $7$ and the $a$. The only digit which cancels the $7$ will be a $2$. This can be done in your head within a few seconds given proper mental arithmetic.

JMoravitz
  • 79,518
  • I have actually never written this down formally, I updated my answer with the steps. Is my solution acceptable? – Maik Klein Jul 25 '16 at 05:52
  • 1
    @MaikKlein it is...correct, but could be phrased better and notation could be made more consistent with what is common. I will update mine with how I would have written it. – JMoravitz Jul 25 '16 at 05:57
  • @MaikKlein Some specific comments about your notation and proof, for congruence, we use \equiv and generally only write \mod at the far right of the line. You introduce a variable $b$ where it is unnecessary. Just continue using $a$. Also, missing a final mention about $2$ being the only digit equivalent to $2\pmod{9}$. It is worth at least citing the result that I mention in the first line of my answer (as otherwise it is unclear how you reached your first step) – JMoravitz Jul 25 '16 at 06:06