# Decimal Representaion

A rational number can be represented in the form p/q. prove that the period of the the repeating decimal should at the most q-1.

-

Hint  If a fraction is writable with denominator $\rm\:10^f\!-1,\:$ and also with denominator $\rm\:10^{q-1}\!-1\:$ then it is writable with their gcd $\rm\:10^{(f,q-1)}\!-1\:$ as denominator, i.e. $\rm\: mq,nq\in\Bbb Z\:\Rightarrow\:(m,n)q\in\Bbb Z.$
Remark $\$ Recall that this properties of denominators is the basis of one conceptual fractional proof of unique factorization of integers. See also this answer for a derivation of the (pre)period formula.
@Farrukh12 The last linked post shows the connection with periodicity and writable with denominator $\rm 10^f\!-\!1.\:$ Was that where you needed help, or elsewhere? You may find it helpful to work through a specific example. – Bill Dubuque Dec 11 '12 at 15:32
If, for some $m>n$, $10^np\equiv10^mp\pmod{q}$, then $(10^n-10^m)p=kq$. Therefore, for some $k_1,k_2$ where $0\le k_2\lt10^{n-m}-1$, we have \begin{align} \frac pq &=\frac k{10^n-10^m}\\ &=\frac{k_1(10^{n-m}-1)+k_2}{10^m(10^{n-m}-1)}\\ &=\frac{k_1}{10^m}+\frac{k_2}{10^n}(1+10^{m-n}+10^{2(m-n)}+10^{3(m-n)}+\dots)\tag{1} \end{align} Obviously, $(1)$ represents a decimal number that eventually repeats with period $n-m$.
To see that we always have some $m>n$, so that $10^np\equiv10^mp\pmod{q}$ and $n-m\lt q$, we simply need to note that there are only $q$ possibilities for $10^np\bmod q$ and if $10^np\equiv0\pmod{q}$, then $\frac pq=\frac k{10^n}$, and therefore, the decimal terminates.