# Prove that $N - M$ $\equiv$ $0$ mod $9$.

We say that a number $N$ is a "rainbow" number if every digit from {$0, 1, .... 9$} shows up exactly once in $N$; for example $1234567890$ and $1029384756$ are both rainbow numbers. Take any two integer rainbow numbers $N$, $M$. Prove that $N - M$ $\equiv$ $0$ mod $9$.

I am trying to use direct prove to find an example of $N$ and $M$ in order to prove this question. Are there any two rainbow numbers that can satisfy above condition? I am kinda stuck here.

• Hint: show that any rainbow number is divisble by 9. – Sean Roberson Aug 14 '18 at 3:08

## 1 Answer

You can't prove it by looking at particular two examples. You have to prove things in general or enumerate things (not a wise move). You can however try to construct some examples (and you should) to help you understand things.

If you want to prove a general statement is false, you can find a counter example, but this is not the case here.

Guide:

• A number is divisible by $9$ if the sum of each digit is divisible by $9$.
• Subtraction of two number that is divisible by $m$ is divisible by $m$.