# Period length in the decimal expansion of fractions $1/n$ [duplicate]

1/7 is 1x 6digits repeating, 1/13 is 2x 6 digits repeating. Why?

I can see this pattern of repeating digits, I can calculate it for most primes but I don't have an intuitive understanding of why it happnes.

I know there are certain rules like 10 ^ k = 1 mod(p) and so on but I am after a plain English understanding if there exists one :)

I would really appreciate it if you could help me with this or point me to resources that explain this.

Fun fact: 2/23 = 22 digits repeating 0.222222222222222/23 = first 15 digits of 2/207 followed by 22 repeating digits of 6/23. True and is similar with different numbers but no clue why?

• I don't understand what you mean by "1/7 is 1x 6digits repeating, 1/13 is 2x 6 digits repeating". A seventh of what has a repetition of 6 digits one time ??? Could you give an example: "In this number we have ..." Commented May 18, 2021 at 9:41
• @JeanMarie I think he means that 1/13 has a period of 6 and two different sets of digits that repeat depending on the numerator (076923 and 153846) Commented May 18, 2021 at 10:33
• @eyeballfrog Thanks! It's now evident... Commented May 18, 2021 at 10:36
• Thank you for your comments the links are really useful, really I am after more material on this ( as I can't seem to find much my self) so thank you for the links
– Fred
Commented May 18, 2021 at 14:05

For prime $$p$$ coprime to $$10$$ you have by Fermat's little theorem that $$p ~| ~[(10)^p - 1].$$

This means that there exists an integer of the form

$$d_{p-1}(10)^{p-1} + d_{p-2}(10)^{p-2} + \cdots + d_0(10)^0$$

where $$d_{p-1}, d_{p-2}, \cdots d_0 \in \{0,1,\cdots, 9\}$$

such that

$$\displaystyle \frac{1}{p} = \frac{d_{p-1}(10)^{p-1} + d_{p-2}(10)^{p-2} + \cdots + d_0(10)^0}{(10)^p - 1}.$$

Further, any fraction of the form

$$\displaystyle \frac{d_{p-1}(10)^{p-1} + d_{p-2}(10)^{p-2} + \cdots + d_0(10)^0}{(10)^p - 1}$$

will have a decimal representation of

$$0.\overline{d_{p-1}~d_{p-2}~\cdots~d_0}.$$

Therefore, for any prime $$(p)$$ coprime to $$(10)$$, the (infinite) decimal representation of $$(1/p)$$ will either have a period of $$(p - 1)$$, or a period of $$k$$, where $$k$$ divides $$(p-1)$$.

The only time that the period will be $$k < (p-1)$$ is if $$p$$ happens to divide $$[(10)^k - 1]$$.

$$(7)$$ (for example) is not a divisor of either $$(99)$$ or $$(999)$$. However, $$(13)$$ which you know has to be a divisor of $$[(10)^{(12)} - 1]$$ also happens to be a divisor of $$(10^3 + 1)$$.

This implies that $$(13)$$ is a divisor of $$(10^3 + 1)(10^3 - 1) = (10^6 - 1).$$

This explains why the decimal representation of $$\frac{1}{13}$$ has a period of $$(6)$$, rather than $$(12)$$.

An example of an unusual way of using the above analysis is to use it to indirectly conclude that the fraction $$(1/11)$$ has a period of $$(2)$$.

This can be reasoned directly simply by noting that $$11 ~| ~99.$$

The (convoluted) indirect way is to notice that the period of $$(1/11)$$ must either be $$(10)$$ or a divisor $$k$$ of $$(10)$$.

Further, you know that $$11 ~| ~[(10)^3 + 1].$$

This implies that $$11 ~| ~[(10)^6 - 1].$$

This means that the period $$k$$ of $$(1/11)$$ must be a common divisor of both $$(6)$$ and $$(10)$$. This allows you to indirectly conclude that $$(k) = 2.$$

• Thank you for your detailed explanation of this idea
– Fred
Commented May 18, 2021 at 14:06