I was trying to divide 24 by 7 using a pen and a paper.

After I had no more space on my checkerboard paper, I decided to put it on a calculator.

The calculator returned 3.428571428571429 and I noticed it rounded up the last ( an 8 became 9) digit so the algorithm could stop.

But in my accounts the number is 3.428571428571428571428571428571...

So I calculated it on a high precision calculator, and I noticed the pattern 857142 will repeat indefinitely.

I already knew this can happen when you do such divisions, now I always wondered myself and asked my teachers but never got an answer to why the numbers repeat themselves. I mean, I could have a whole sort of random numbers and that'd be ok, I just wonder why they have this pattern.

Is there any article or study on that so I can read it?

  • 6
    $\begingroup$ Note that every rational number has a repeating decimal expansion. $$1 = 1.0000000...$$ $\endgroup$ – user157227 May 20 '15 at 0:16
  • 2
    $\begingroup$ Short answer: 24/7 is a rational number, and as such its decimal part is either finite or periodic. $\endgroup$ – Américo Tavares May 20 '15 at 0:17
  • 6
    $\begingroup$ @user157227 ...or $$1 = 0.\dot{9}$$ $\endgroup$ – Iridium May 20 '15 at 12:05
  • 1
    $\begingroup$ The repeated sequence 142857 has the interesting property that 14 is 2 times 7, 28 is 4 times 7 and 57 is one more than 8 times 7. Also, if you look at the decimal versions of 1/7, 2/7, 3/7, 4/7, 5/7 and 6/7, you will find that the repeated sequence is always 142857. $\endgroup$ – Theodore Norvell May 21 '15 at 11:36

The answer is: long division.

Do the long division and you'll see 'an explanation for the repetitions after decimal point' yourself. :)

  • 3
    $\begingroup$ +1 This answer is short and lacks detailed explanation, but I feel compelled to upvote it. Once one actually does the long division, and doesn't just read an explanation, it becomes easier to realize what happens. After that, it is easier to understand answers to the natural question if this repetition occurs always. $\endgroup$ – JiK May 20 '15 at 10:42
  • 2
    $\begingroup$ @JiK Thanks. :) That's why I consider teaching such ancient routines like long division or descriptive geometry very important. Of course I know it's over 2000 a.Chr.n. and we have computers now which make trillions divisions in a time I need to write down a single digit on the paper. However computers give us just a pure result while manual operations (done from time to time) may give us (from time to time) enormous insight in what we actually do. $\endgroup$ – CiaPan May 20 '15 at 11:35

When you do the long division for $a/b$, at each decimal, you end up with a remainder which is in the range $0,1,2,\dots,b-1$. That means, at some point, you must get a repeated remainder. But once you get a repeated remainder, you start getting repeated digits.

One thing to note - terminating decimals are also "repeating" - they just repeat $0$.

Any decimal expansion that eventually repeats can be written as a fraction. For example, if:



$$\begin{align}10000x&=1295.343434\dots\\ 1000000x&=129534.3434\dots\end{align}$$

Subtracting, and you get:

$$990000x = 129534-1295 = 128239$$

There is more going on, which is mostly concerned with "elementary number theory."

For example, if $p$ is prime, then $\frac{a}{p}$ will always have a repeating decimal expansion with repetitions of some length which is a divisor of $p-1$. For example, $p=7$ means any $\frac{a}{7}$ will have a repetition of length $6$. $\frac{a}{13}$ has a repetition of length $6$, also. $\frac{a}{17}$ has a repetition of length $16$. $37$ has a repetition of length $3$ which divides $36$.

  • $\begingroup$ More generally, assuming $\frac{a}{n}$ is irreducible you have that the repeating decimal expansion of $\frac{a}{n}$ has length that divides $\phi(n)$. See Wikipedia. $\endgroup$ – Aurélien Ooms May 20 '15 at 13:57
  • 2
    $\begingroup$ Yes, but I'm getting the impression that this is way outside the level of the OP. @AurélienOoms $\endgroup$ – Thomas Andrews May 20 '15 at 13:59

First of all $$ \frac{24}{7} = \frac{3 \cdot 7 + 3}{7} = 3 + \frac{3}{7}, $$ so let me answer why $$ \frac{3}{7} = 0.428571\,428571\,428571\,428571\,428571 \cdots $$ Let $$ \begin{align} x &= 0.428571 \\ &+ 0.000000\,428571 \\ &+ 0.000000\,000000\,428571 \\ &+ 0.000000\,000000\,000000\,428571 \\ &+ 0.000000\,000000\,000000\,000000\,428571 \\ &\phantom{\;\;}\vdots \\ &= \frac{428571}{1000000^1} + \frac{428571}{1000000^2} + \frac{428571}{1000000^3} + \frac{428571}{1000000^4} + \frac{428571}{1000000^5} +\cdots \end{align} $$ with each additional term being a million times smaller than the previous. Convince yourself that $$ 1\,000\,000 x = 428\,571 + x $$ or that $$ 999\,999 x = 428\,571. $$

So, it turns out that $$ x = \frac{428\,571}{999\,999} = \frac{3}{7}. $$

Why did this work? If you consider the list of numbers of the form $$ \begin{align} 9 &= 10^1 - 1 \\ 99 &= 10^2 - 1 \\ 999 &= 10^3 - 1 \\ 9\,999 &= 10^4 - 1 \\ 99\,999 &= 10^5 - 1 \\ 999\,999 &= 10^6 - 1 \\ &\vdots \end{align} $$ eventually $7$ will divide one of them (without remainder). Does $7$ divide $9$? No. Does $7$ divide $99$? No. $\dots$ Does $7$ divide $999\,999$ Yes! $$ 999\,999 = 7 \cdot 142\,857 $$ so $$ \frac{3}{7} = \frac{3 \cdot 142\,857}{7 \cdot 142\,857} = \frac{428\,571}{999\,999} $$ and the repeating block of the decimal expansion is $428571$. For any fraction $\frac{a}{b}$, find a number of the form $10^N - 1$ ($N$ many $9$s) that is a multiple of $b$, and this is always possible! Say that $b \cdot r = 10^N - 1$ on the nose; then $$ \frac{a}{b} = \frac{a \cdot r}{10^N - 1}, $$ so the string of $N$ digits that make up $a \cdot r$ forms the repeating block in the decimal expansion.

  • 8
    $\begingroup$ It's not obvious, however, to a person who hasn't studied some elementary number theory, why some $10^n-1$ must be divisible by any $q$ (and it is not quite true - it is only true for denominators relatively prime to $10$.) $\endgroup$ – Thomas Andrews May 20 '15 at 12:27

The algorithm for long division between two natural numbers can be recursively expressed in terms of two sequences of whole numbers $d_n\text { and } r_n$ with $d_n$ being the $n^{th}$ digit after the decimal point and $r_n$ being the remainder after the $n^{th}$ digit has been calculated.

let $d_0$ be the denominator of your fraction and $r_0$ be the numerator.

then the recursive formulae can be expressed as ...

$$d_{n+1} = INT \left ( \frac{10 r_n}{d_0} \right)\text{ and } r_{n+1} = ( 10 r_{n} \mod d_0 ) $$

One advantage of looking at it this way is that it is really easy to code into a spreadsheet and make graphs of the first 200 digits of $\frac{1}{223}$

Another advantage is that it makes it easy to see that only the number $d_0$ and the sequence $r_n$ are involved in the recursion, so that when $r_n$ repeats it must repeat indefinitely.

you can also see that if $r_N=0$ for some $N$ then $r_n=0$ for all $n>N$

So to be a "repeating" decimal every element of $r_n$ for $n>0$ must be a natural number between $1$ and $d_0 -1$

So the maximum length of the period is $d_0-1$


In addition to the division algorithm explanation there is also in fact a number theoretic explanation for this which is quite neat. Let $q\in\mathbb{Q}$ be any rational number. Write it in the form $q=\frac{n}{2^a5^bm}$ where $\gcd(10,m)=1$. At this point we are just trying to clean out all possible factors of $10$ from $m$. Now consider $10^{\max(a,b)}q=\frac km$ where $k$ is an integer. By the division algorithm $$10^{\max(a,b)}q=\frac km=p+\frac rm,\quad0\le r<m,\quad r,p\in\mathbb{Z}$$ Now for the touch of number theoretic magic. Since $\gcd(10,m)=1$, by Fermat-Euler $$10^{\phi(m)}\equiv1\pmod m$$ But that means $$10^{\phi(m)}-1=lm$$ for some integer $l$. Thus $$\frac rm=\frac {rl}{ml}=\frac{rl}{10^{\phi(m)}-1}$$ But $r<m$ so $rl<ml=10^{\phi(m)}-1$ and so we can write $rl$ as $$rl=d_1d_2\dots d_{\phi(m)}$$ and so $$\frac{rl}{10^{\phi(m)}-1}=d_1d_2\dots d_{\phi(m)}\left(\frac{1}{10^{\phi(m)}}+\frac{1}{10^{2\phi(m)}}+\frac{1}{10^{3\phi(m)}}\right)$$ So we have found the recurring part of the decimal expansion!


Examine what happens when you divide $7$ into $1$.

\begin{array}{l} \phantom{7)}\underline{\phantom{1}.1428571\cdots} \\ 7)\color{red}{1.0}000000000\\ \phantom{7)1.}\underline{\color{red}7} \\ \phantom{7)1.}30 \\ \phantom{7)1.}\underline{28} \\ \phantom{7)1.0}20 \\ \phantom{7)1.0}\underline{14} \\ \phantom{7)1.00}60 \\ \phantom{7)1.00}\underline{56} \\ \phantom{7)1.000}40 \\ \phantom{7)1.000}\underline{35} \\ \phantom{7)1.0000}50 \\ \phantom{7)1.0000}\underline{49} \\ \phantom{7)1.00000}\color{red}{10} \\ \phantom{7)1.000000}\underline{\color{red}{7}} \\ \phantom{7)1.000000}30 \\ \end{array}

Notice that the first $1$ in the quotient was obtained by dividing $7$ into $10$ and that the next time $1$ occurred, it was obtained the exact same way. Since dividing by $7$ can result in no more than $7$ remainders $(0,1,2, \dots , 6)$, then eventually a remainder must be repeated. Once a remainder is repeated.Then the numbers in the quotient must repeat too.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.