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.

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

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.


  • 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$.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.