How long before digits repeat

  • Thread starter gmax137
  • Start date
In summary, when dividing a rational number by a rational number, if the division results in a repeating decimal expansion, then the length of the repeating decimal expansion is the same as the length of the numerator divided by the length of the denominator.
  • #1

gmax137

Science Advisor
2,629
2,534
Hey I'm pretty new here, this is a cool site. Sorry if this has been asked before.

When I carry out a division to get the decimal representation of a rational number n/m, is there a way to figure out how far out it will go before the representation terminates in zeros or before it starts to repeat? Is there a name for this?
 
Physics news on Phys.org
  • #2
gmax137 said:
When I carry out a division to get the decimal representation of a rational number n/m, is there a way to figure out how far out it will go before the representation terminates in zeros or before it starts to repeat? Is there a name for this?
Sloane's sequence A114206, which is related to http://www.research.att.com/~njas/sequences/A114205" [Broken]
Write decimal expansion of 1/n as 0.PPP...PQQQ..., where QQQ... is the cyclic part. If the expansion does not terminate, any leading 0's in QQQ... are regarded as being at the end of the PPP...P part. Sequence gives PPP...P, right justified, with leading zeros omitted.

Comment: b(n) = A114206(n) gives the length of P (including leading zeros), c(n) = A036275(n) gives the smallest cycle in QQQ... (including terminating zeros), and d(n) = A051626(n) gives the length of that cycle.
Thus 1/n = 10^(-b(n)) * ( a(n) + c(n)/(10^d(n) - 1) ). When c(n)=d(n)=0, the fraction c(n)/(10^d(n) - 1), which is 0/0, evaluates (by definition) to 0.​

Link to http://www.research.att.com/~njas/sequences/A114206" [Broken].
 
Last edited by a moderator:
  • #3
gmax137 said:
Hey I'm pretty new here, this is a cool site. Sorry if this has been asked before.

When I carry out a division to get the decimal representation of a rational number n/m, is there a way to figure out how far out it will go before the representation terminates in zeros or before it starts to repeat? Is there a name for this?


Suppose n/m has a decimal representation that repeats itself with a period of q. If n/m > 1/10, then multiplying n/m by 10^p, would shift the decilas p laces and after the decmal place all the numbers would be the same. so, the factional part of n/m and the fractional pat of 10^p n/m are the same. So, this means that if you divide n by m then the remainder will be the same as when you divide 10^p n by m:

n Mod m = n 10^p Mod m

If n and m are relatively prime you can divie both sides by n:

10^p Mod m = 1

If 10 is relatively prime to m, then Euler's theorem says that we always have:

10^(phi(m)) Mod m = 1

where phi(m) is the number of integers smaller than m that are relatively prime to m, which can be computed from:

phi(m) = m product over all primes q that divide m of (1-1/q)

p is the smallest number to which you have to raise 10 to get 1. This is called the order of 10. It then follows that p divides phi(m). (if not then you can construct a smaller number p' such that 10^p' Mod m = 1).

If m is prime number than phi(m) = m-1. So, e.g. phi(7) = 6. So, the period of 1/7 must be a divisor of 6. It is in fact 6: 1/7 = 0.1428571428...
 
  • #4
Count: You described the period (length) of the recurring decimal, not the length of the leading (nonperiodic) part of the decimal expansion.
 
  • #5
Does it have to be so complicated? Apply the http://en.wikipedia.org/wiki/Pigeonhole_principle" [Broken]. The decimal expansion of [itex] \frac n m [/itex] must repeat within m digits.

The denominator determines the possible number of remainders available in the long division process. Once you have either cycled through all of the possible remainders or repeat a remainder the decimal expansion must repeat.
 
Last edited by a moderator:
  • #6
D H said:
Count: You described the period (length) of the recurring decimal, not the length of the leading (nonperiodic) part of the decimal expansion.

I see! I didn't read the question well. :smile:
 

Suggested for: How long before digits repeat

Replies
1
Views
581
Replies
5
Views
693
Replies
11
Views
768
Replies
2
Views
589
Replies
8
Views
894
Replies
1
Views
1K
Back
Top