Let us show that if p is prime with (p;10)=1 then has a period such that (1)
Indeed by Fermat's Little Theorem thus there is a positive integer such that
Let be the number of digits of n.
Then if we have that where (2)
Now remember that if we have: where in the denominator we have t nines and it can be expressed with a decimal expansion that has a period length of t digits, but this doesn't mean there are no digits repeated, it only means that the minimun period divides t
Thus back in (2) we have that may be expressed with a period of p-1 digits thus the period of divides
This means that (1) is a necessary condition.
The proof for the case where p is prime (p;10)=1, (p;a)=1 has little difference