Respuesta :

DeanR

Great question.  The answer is N-1.

Think about doing long division.  We append a 0, get another digit in the quotient, multiply and subtract to get a remainder.  We can assume that remainder is not zero because then we wouldn't have a repeating decimal.   At each step the remainder has to be less than N, because we're dividing by N.

So there are N-1 possibilities for the remainder.  On the off chance we generate N-1 digits and N-1 remainders and none repeat, we know the next one will repeat, because we've already generated all the possible remainders.  

So the largest size of the repeating portion is N-1.   This maximum happens first for 1/7.