Comment by krackers

4 hours ago

(This works because x/9 = 0.xxxx..., xy/99 = 0.xyxyxy... and so on). And that is true intuitively because when you long divide in order to get a repeating pattern you need the remainder to be the same as what you started with. I.e if you long divide

       0.n
      -----
    a| b.0

You need 10b - an = b which implies 9b = an. If a = 9 (i.e. your divisor is of the form 10^n - 1, then b=n and you not only have a repeating pattern but you repeat digits.

Or going the other way, if d = 10^n - 1 then [10 a = a (mod d)] so your remainders never change. And then note that

  a * 10^n = a * (10^n - 1) + a

so your quotient is just `a` as well.