<s>[INST] How would I solve $n(a) := 3 1 7 2 a 6 3 7 5$ with $9|n(a)$? $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.  
 [/INST] 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.
</s>