Associated Topics || Dr. Math Home || Search Dr. Math

### Calculating Lengthy Repeating Decimals

```Date: 10/26/2006 at 21:14:22
From: Cy
Subject: 355/113

Hi, Dr. Math.

I'm currently enrolled in 8th grade algebra, and I just had a question
I was curious about.  You know the approximation of pi, 355/113?
Well, I was trying to figure out if I could turn it into a decimal
using long division, and find out if the decimal repeats or ever
terminates.  Can you please show me how to find when (or if) the
decimal terminates/repeats?

I am currently still using long division to find my answer, and have
been unsuccessful.  This is what i have so far:

3.141592920346902654867256637168141592920353982300884070709645...

Thanks,
Cy

```

```
Date: 10/27/2006 at 00:49:51
From: Doctor Greenie
Subject: Re: 355/113

Hello, Cy --

If the decimal representation of a fraction terminates, then we can
give the decimal fraction an exact name, using base 10 place values:

.103 = 103 thousandths = 103/1000
.48932 = 48932 hundred thousandths = 48932/100000
.15 = 15 hundredths = 15/100 = 3/20

If the common fraction can't be written as an equivalent fraction with
a denominator which is a power of 10, then the decimal form of the
fraction will not terminate.  So the only common fractions which have
decimal representations which terminate are those whose denominators
contain prime factors of only 5 and/or 2 (the prime factors of the
base, 10).

So your fraction 355/113 will not terminate.

Now... how many digits will the repeating decimal go before it
repeats?  We can't tell before we start calculating; however, we know
that the number of places will be less than the denominator.  If you
think about the long division process, and about the fact that the
division never terminates, then the only possible remainders at each
step are 1 through 112.  Since we can have at most 112 different
remainders in the long division process, we must get a repeated
remainder after at most 112 steps; and so the repeating decimal part
of 355/113 can be at most 112 digits long.

And in fact, with a large prime denominator like 113, it is quite
likely that the repeating decimal pattern will be 112 digits long.

One way to find the repeating decimal part is long division, as you
have attempted.  This of course can be very tedious, and arithmetic
mistakes are easy to make.  You have made an error somewhere,
because your result is only correct this far:

3.1415929203

The next digit should be "5"; you show "4".

Is there a way to find the repeating decimal faster than long
division?  Yes, there is.  To understand the quicker method for
finding the decimal representation of 355/113, let's look at the
calculation of the first several decimal places using long division:

3.14159292035...
--------------------
113 ) 355.00000000000000
339
-----
16 0
11 3
-----
4 70
4 52
-----
180
113
----
670
565
----
1050
1017
-----
330
226
----
1040
1017
-----
230
226
----
400
339
----
610
565
---
45...

After the whole number part of the answer is obtained, the remainder
is 16.  So at this point we are dividing "16" followed by an
infinite string of 0's by 113.  Then after the 8th decimal place,
the remainder is 4.  So from this point on, we are dividing "4"
followed by an infinite string of zeros by 113.  Since 4 is 1/4 of
16, the sequence of digits we will get starting here is the string
of digits we have obtained to this point, divided by 4.

So we can find the complete repeating decimal representation of
355/113 by using long division or some other technique to get the
first several decimal places and then dividing that string of digits
by 4.  Division by 4 is much easier than division by 113, so the
overall time required to find the complete repeating decimal is
shortened.  Here is how the beginning of the process went when I
used the calculator on my PC....

355/113 = 3.1415929203539823008849557522124
/4 = 0.7853982300884955752212389380531
/4 = 0.19634955752212389380530973451327
/4 = 0.049087389380530973451327433628319
/4 = 0.01227184734513274336283185840708
/4 = 0.0030679618362831858407079646017699

Now we can "splice together" the appropriate digits from these
strings.  For example, the last digit in the first line is rounded,
so we look at the several preceding digits, "5752212", and we look
for that sequence of digits in the next line.  The digits in the
second line following this sequence are "389380531", with the last
digit "1" having been rounded; we splice these digits onto the other
digits we already have.  So then in the third line we find the
string of digits "38053" and copy the next several digits from that
line, omitting the last digit.  And so on....  We get the following:

355/113 = 3.14159 29203 53982 30088 49557 52212 38938 05309 --
73451 32743 36283 18584 07079 64601 769...

I have grouped the digits into groups of 5 so we can keep track of
how many decimal places we have gone.  At this point, we have found
73 digits--more than half the maximum possible length of the repeating
pattern--without the pattern repeating.  For reasons I don't think I
could explain, that means the repeating sequence of digits will in
fact be the full 112 digits long.  It also means that somewhere in our
string of digits we will find a string of digits which is the "9's
complement" of the beginning digits.

Here is an example (somewhat familiar to you, I hope) of what this
means.  If we look at the decimal representation of 1/7...

1/7 = .142857142857....

digits 4-6 in the repeating pattern are the "9's complement" of digits
1-3, meaning 142+857=999.

So somewhere in our string of the first 73 digits of the decimal
representation of 355/113, we should find a string of digits which is
the "9's complement" of the first several digits:

9999999...
- 1415929...
----------
8584070...

And indeed we do find this string, starting with the 57th digit.
(Note: (112/2)+1 = 57--the 57th digit is the first digit in the second
half of the 112-digit repeating pattern; the two 56-digit halves are
9's complements of each other.)

And so now we can complete the process of finding the 112-digit
repeating pattern for 355/113 by using the 9's complement of the first
56 digits:

355/113 = 3.14159 29203 53982 30088 49557 52212 38938 05309 --
73451 32743 36283 1 --

85840 70796 46017 69911 50442 47787 61061 94690 --
26548 67256 63716 8...

If you are really good with mental math (specifically, dividing by 4),
you can find this complete repeating pattern by taking the digits you
already have and dividing by 4 to get subsequent digits....

Finally, when I first started working on your problem and wanted to
check my calculations, I looked into finding repeating decimal
for performing repeated calculations.  It turned out to be relatively
easy to set up a spreadsheet to mimic the long division process.  (If
does so they can show you this process....)

Here's what we do on the spreadsheet to find the repeating decimal
for 355/113:

(1) In cell B1, enter "16".

We don't really care about the whole number part of the answer, "3"--
we are only interested in the remainder after the first step, which
is 16.

(2) In cell A2, enter the following formula:  =FLOOR(10*B1/113,1)

This formula multiplies the remainder from cell B1 (16) by 10, divides
it by 113, and rounds down to the nearest whole number.  This mimics
the process of finding the next digit of the answer.  (16 times 10 =
160; 160/113 = 1 remainder 47; next digit is "1", and the remainder
is 47.)

(3) In cell B2, enter the following formula:  =10*B1-113*A2

This formula finds the new remainder by multiplying the previous
remainder by 10 and subtracting 113 times the digit you just found.
(16 times 10 = 160; 160-113(1) = 47.)

(4) Highlight cells A2 and B2, drag down until you have reached to or
past cells A113 and B113, and use the "edit/fill/down" feature
(control-D in Microsoft Excel) to copy the formulas in cells A2 and
B2 to the remaining rows of columns A and B.

The sequence of digits in cells A2 through A113 are the digits of the
repeating decimal representation of 355/113.  You will see that the
digits begin repeating with cell A114.

Thanks for submitting your question.  I got a lot of good mental
exercise out of it; and I discovered an easy way to use a spreadsheet
to mimic the long division process and thus provide a quick path to
finding the decimal representation of any repeating fraction.

I hope all this helps.  Please write back if you have any further

- Doctor Greenie, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory
Middle School Fractions

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search