Recurring decimals in prime fractions

In summary, the period of a prime reciprocal 1/p is the order of 10 mod p, and the period of 1/pq is the order of 10 mod pq. There is a relationship between the periods of different prime reciprocals and the order of 10 mod n, where n is the product of the primes. The period of 1/pq is equal to the product of the periods of 1/p and 1/q if and only if the order of 10 mod p and q are relatively prime. This can be explained by the relation between the period of a number n with gcd(10,n)=1 and the order of 10 mod n.
  • #1
Oxymoron
870
0
When I write out the decimal expansion of [itex]1/p[/itex] where [itex]p[/itex] is a prime, it is always a recurring decimal with a period [itex]per(p)[/itex]. I was thinking why inverting a prime number should always give a recurring decimal but could not think of a reason other than it has to be something to do with our base 10 system of counting.

Some prime reciprocals, such as 1/7, 1/17, and 1/19 have periods which is one less that the prime. That is, [itex]per(p) = p-1[/itex] for some primes. And in fact, for all primes [itex]p[/itex], [itex]per(1/p)\,|\,(p-1)[/itex]. These are all interesting but there is something which I can't seem to explain.

Take the prime 11. Then the period of 1/11 is 2. Take some other prime p. Then

[tex]per\left(\frac{1}{11}\times\frac{1}{7}\right) = 2per\left(\frac{1}{p}\right)[/tex]

so long as [itex]p < 31[/itex].

After looking at 1/11, I started looking at other prime reciprocals, hoping to find other relationships between the periods of 1/p, 1/q and 1/pq. Unfortunately, the only thing I could find was that

[tex]per\left(\frac{1}{p}\times\frac{1}{q}\right) = \infty[/tex]

whenever [itex]p=q[/itex] and the period of 1/p is odd.

I was hoping for a nice clean relationship between 1/p,1/q, and 1/pq but I could not find one at all. So I tried checking the web and again, no one seems to have found any relationships. So I came here. If anyone has seen, or done any work on comparing periods of different prime reciprocals, could you please share your knowledge.

Cheers.
 
Last edited:
Physics news on Phys.org
  • #2
Oxymoron said:
Some prime reciprocals, such as 1/7, 1/17, and 1/19 have periods which is one less that the prime. That is, [itex]per(p) = p-1[/itex] for some primes. And in fact, for all primes [itex]p[/itex], [itex]per(1/p)\,|\,(p-1)[/itex]. These are all interesting but there is something which I can't seem to explain.

These, and the relation you want for 1/pq, can be explained by the relation between the period of 1/n and the order of 10 mod n (you're interested in the case gcd(10,n)=1 here, though the other case is worth looking at).

Oxymoron said:
Take the prime 11. Then the period of 1/11 is 2. Take some other prime p. Then

[tex]per\left(\frac{1}{11}\times\frac{1}{7}\right) = 2per\left(\frac{1}{p}\right)[/tex]

so long as [itex]p < 31[/itex].

This isn't true, the period of 1/7 is 6, the period of 1/77 is also 6.

Oxymoron said:
[tex]per\left(\frac{1}{p}\times\frac{1}{q}\right) = \infty[/tex]

infinity? This can't be true either, it will always be finite as 1/pq is a rational number, and hence its decimal either terminates or repeats.
 
  • #3
Posted by Shmoe

These, and the relation you want for 1/pq, can be explained by the relation between the period of 1/n and the order of 10 mod n (you're interested in the case gcd(10,n)=1 here, though the other case is worth looking at).

What is n here? Does n = pq?
 
Last edited:
  • #4
Oxymoron said:
What is n here? Does n = pq?

Sure, if you like. It doesn't have to be the product of 2 primes though, there's a nice relation between the period of a number n with gcd(10,n)=1 and the order of 10 mod n.
 
  • #5
Posted by Shmoe

Sure, if you like. It doesn't have to be the product of 2 primes though, there's a nice relation between the period of a number n with gcd(10,n)=1 and the order of 10 mod n.

That got me thinking...

The period of 1/p is the order of 10(mod p) right? so we have a congruence relation:

[tex]10^r \equiv 1(\mod p)[/tex]

The period of 1/q is the order of 10(mod q). So:

[tex]10^s \equiv 1(\mod q)[/tex]

And the period of 1/pq is the order of 10(mod pq). So:

[tex]10^t \equiv 1(\mod pq)[/tex]

...
 
  • #6
No matter what prime p we take, p is always relatively prime to 10 (since p has no divisors anyway). Take a prime. Then suppose that p divides [itex]10^r-1[/itex], that is, [itex]nm = 10^r - 1[/itex] for some integer [itex]1\geq m < 10^r[/itex]. Then

[tex]\frac{1}{n} = \frac{m}{10^r-1} = m(10^{-r} + 10^{-2r} + \dots)[/tex]

If our integer [itex]m = a+0 + 10a_1 + 10^2a_2 + \dots 10^{r-2}a_{r-2} + 10^{r-1}a_{r-1}[/itex] for decimal digits [itex]a_0,\dots,a_{r-1}[/itex], then the decimal expansion of 1/p will be

[tex]\frac{1}{p} = 0.a_{r-1}a_{r-2}\dots a_1a_0a_{d-1}a_{d-2}\dots a_1a_0\dots[/tex]

which will repeat with a period that will always divide r.

Then the period of 1/p is the smallest r such that p divides 10^r-1. In other words, the period of 1/p is the smallest d such that

[tex]10^r \equiv 1(\mod p)[/tex]

But this is the definition of [itex]\mbox{ord}_p(10)[/itex].

So the period of 1/p is the order of 10(mod p).
 
Last edited:
  • #7
Which should mean that

[tex]\mbox{per}\left(\frac{1}{pq}\right) = \mbox{ord}_{p+q}(10)[/tex]
 
  • #8
Oxymoron said:
Which should mean that

[tex]\mbox{per}\left(\frac{1}{pq}\right) = \mbox{ord}_{p+q}(10)[/tex]

Should be the order of 10 mod pq, not p+q. Now do you know how to find the oder of 10 mod pq from the orders mod p and mod q?
 
  • #9
Posted by Shmoe

Should be the order of 10 mod pq, not p+q. Now do you know how to find the oder of 10 mod pq from the orders mod p and mod q?

Of course, pq, nor p+q, I don't know why I wrote that. :confused:

I think I may know, although I kind of jumped at that conclusion without properly running through it.

[tex]\mbox{per}(1/p)\times\mbox{per}(1/q)[/tex]

is the order of 10(mod pq). If you let n = pq (although I may now understand what you mean by this, n can be any integer so long as it is relatively prime to 10?) then

[tex]\mbox{per}(1/p)\times\mbox{per}(1/q) = \mbox{per}(1/n)[/tex]

which is equal to the order of 10(mod n) = 10(mod pq). Which is the same thing as

[tex]\mbox{per}(1/pq) = \mbox{ord}_{pq}(10)[/tex]
 
Last edited:
  • #10
Oxymoron said:
(although I may now understand what you mean by this, n can be any integer so long as it is relatively prime to 10?)

Yes. If it's not relatively prime, then it's a terminating decimal.

Oxymoron said:
[tex]\mbox{per}(1/p)\times\mbox{per}(1/q) = \mbox{per}(1/n)[/tex]

Remember th 1/7 and 1/11 example? The period of 1/11 was 2, the period of 1/7 was 6, the period of 1/77 was 6, so it's not the product of the periods.

Try a few more examples to see if you can spot a relationship. You might want to think in terms of the order of 10 mod p and q here. Specifically if r is the order of 10 mod p and 10^t=1 mod p then r divides t. Also, if 10^t=1 mod pq then 10^t=1 mod p.
 
  • #11
For example

1/7. Find [itex]\mbox{ord}_7(10)[/itex]

[tex]10^2 \equiv 2(7)[/tex]
[tex]10^3 \equiv 6(7)[/tex]
[tex]10^4 \equiv 4(7)[/tex]
[tex]10^5 \equiv 5(7)[/tex]
[tex]10^6 \equiv 1(7)[/tex]

and we have exhausted mod 7. So infact,

[tex]\mbox{ord}_7(10) = 6[/tex]

p=17. Find [itex]\mbox{ord}_17(10)[/itex].

[tex]10^2 \equiv 15(17)[/tex]
[tex]10^4 = 15^2 \equiv (-2)^2 \equiv 4(17)[/tex]
[tex]10^8 = 4^2 \equiv 16(17)[/tex]

Thus we can see that [itex]\mbox{ord}_{17}(10)[/itex] is not 1,2,4, or 8. But we must remember that [itex]\mbox{ord}_{17}(10)[/itex] divides [itex]\phi(17) = 16[/itex]. The divisors of 16 are 1,2,4,8, and 16. Therefore [itex]\mbox{ord}_{17}(10) = 16[/itex].

Now find [itex]\mbox{ord}_{7\cdot 17}(10)[/itex]

[tex]\mbox{ord}_{7\cdot 17}(10) \Rightarrow 10^{rs} \equiv 1(7\cdot 17)[/tex]

But is there a quicker way of doing this other than working them all out?
 
Last edited:
  • #12
Suppose the order of 10 mod 7*17 is t. Then 10^t=1 mod 7*17. So we have both:

10^t=1 mod 7
10^t=1 mod 17

What does this tell you about t compared to 6 and 16 (the orders of 10 mod 7 and 17).
 
  • #13
But surely t can't take on two values at the same time?
 
  • #14
So 7 divides t-1 and 17 divides t-1. So 6 divides t and 16 divides t. So t=48 works but t=48 = lcm(6,16).
 
Last edited:
  • #15
Oxymoron said:
So 7 divides t-1 and 17 divides t-1.

Nope. You maybe mistyped?

Oxymoron said:
So 6 divides t and 16 divides t.

Which shows lcm(6,16) divides t. You should also be able to show t divides lcm(6,16), then you'd have equality. Of course showing 10^48=1 mod 7*17 directly would work as well, but you can prove this lcm relation in general.
 
  • #16
Nope. You maybe mistyped?

Yeah, I meant to write

7 divides 10^t - 1 and 17 divides 10^t -1

=>

6 divides 10^t and 16 divides 10^t

which just comes from the definition of

[tex]10^t \equiv 1(\mod 7)[/tex]

and

[tex]10^t \equiv 1(\mod 17)[/tex]
 
  • #17
Which makes it that

[tex]\mbox{lcm}(6,16) \mbox{ divides } 10^t[/tex]
 
  • #18
Oxymoron said:
Yeah, I meant to write

7 divides 10^t - 1 and 17 divides 10^t -1

=>

6 divides 10^t and 16 divides 10^t

7 divides 10^t - 1 implies 6 divides t, not 10^t (as 6 is the order of 10 mod 7). Similiar for 16, which is why we have lcm(6,16) divides t.
 
  • #19
Ahah! of course! of course! (I was lucky getting the right answer from incorrect calculations).

So finally we have that if

[tex]\mbox{ord}_{pq}(10) = t[/tex]

then

[tex]t = \mbox{lcm}(p-1,q-1)[/tex]
 
  • #20
and since

[tex]\mbox{ord}_{pq}(10) = \mbox{per}(1/pq)[/tex]

we have

[tex]\mbox{per}(1/pq) = \mbox{lcm}(p-1,q-1)[/tex]
 
  • #21
What about

[tex]\mbox{per}\left(\frac{1}{p^2}\right)[/tex]?

we have

10^t = 1(mod p^2)

=>

p^2 - 1 divides t

where [itex]t = \mbox{ord}_{p^2}(10)[/itex]
 
  • #22
Oxymoron said:
[tex]\mbox{per}(1/pq) = \mbox{lcm}(p-1,q-1)[/tex]

This was luck again! It works for the p=7 and q=17 case, but what if p=7 and q=11?
 
  • #23
What!? How can it work for my random choice of prime numbers but not for another choice? Noooo!
 
  • #24
Maybe not all is lost...
 
  • #25
7 and 17 where peculiar because the period of 1/7 was 7-1, and the period of 1/17 was 17-1. So Ill take a stab in the dark an proclaim:

[tex]\mbox{per}(1/pq) = \mbox{lcm}(\mbox{per}(1/p),\mbox{per}(1/q))[/tex]
 
  • #26
Oxymoron said:
7 and 17 where peculiar because the period of 1/7 was 7-1, and the period of 1/17 was 17-1. So Ill take a stab in the dark an proclaim:

[tex]\mbox{per}(1/pq) = \mbox{lcm}(\mbox{per}(1/p),\mbox{per}(1/q))[/tex]

Ding, ding, ding! We have a winner (note here the assumption that gcd(p,q)=1). The order of 10 being the lcm of the other orders is the easiest way to think about this, and the easiest way to prove it.
 
  • #27
Yay!



I also came up with something for the period of 1/p^2.

Let [itex]\mbox{ord}_{p^2}(10) = t[/itex]

Then

[tex]10^t \equiv 1(\mod p^2)[/tex]
=>
[tex]p^2\,|\,t-1[/tex]
=>
[tex]p^2-1\,|\,t[/tex]

Then p^2-1 divides t. But p^2-1 is always an even number for all primes p. So t is even, since [itex]t=\lambda(p^2-1)[/itex] for some lambda.


But then the period 1/3*1/3 = 1/9 = 0.11111 has a period of 1 which is not even. Argh.
 
Last edited:
  • #28
The group of units mod p^2 has order phi(p^2)=p*(p-1). The order of 10 mod p^2 will divide this. Remember Euler's theorem?
 
  • #29
When I was working through the proof of the first one with you, it worked because when we did

10^t = 1(mod 7) => 7 | 10^t - 1 => (7-1) | t

and luckily (7-1) happened to be the period of 1/7.

But say we had 11...then

10^t = 1(mod 11) => 11 | 10^t - 1 => (11-1) | t

and now (11-1) is NOT the period of 11.

So if I had been working with say 3 and 11, I would not have discovered the lcm bit! This is why I can't work out the period of 1/p^2.
 
  • #30
So when I got to the step

[tex]10^t \equiv 1(\mod p)[/tex]
[tex]10^t \equiv 1(\mod q)[/tex]

=>

[tex]p\,|\,t-1[/tex]
[tex]q\,|\,t-1[/tex]

but now I can't simply say

p-1 | t => per(1/p) | t

because p-1 is the period of 1/p (like I did when p=7,q=11), because p-1 is NOT the period of arbitrary primes. So wha
 
  • #31
Oxymoron said:
So when I got to the step

[tex]10^t \equiv 1(\mod p)[/tex]
[tex]10^t \equiv 1(\mod q)[/tex]

=>

[tex]p\,|\,t-1[/tex]
[tex]q\,|\,t-1[/tex]

You've typed this sort of implication enough times I'm getting concerned it's not a typo. 10^t=1 mod p does not in anyway mean p divides t-1. You do however know that the order of 10 mod p will divide t if 10^t=1 mod p. In other words, if you raise 10 to an exponent and get 1, then this exponent is a multiple of the order. You also know the order of 10 mod p will divide p-1, the order of the group of units mod p is just p-1 (in general it's phi(n)).
 
  • #32
Excellent. So I was lucky that the period of 1/7 equalled 7-1 AND phi(7) = 7-1. That was where I was getting confused.

So for 1/pq we could have written

per(1/pq) = lcm(phi(p),phi(q))
 
  • #33
Oxymoron said:
Excellent. So I was lucky that the period of 1/7 equalled 7-1 AND phi(7) = 7-1. That was where I was getting confused.

So for 1/pq we could have written

per(1/pq) = lcm(phi(p),phi(q))

This isn't correct- it's the 'luck' mistake that you just mentioned. You don't necessarily have per(1/p) equal to phi(p). You know per(1/p) divides phi(p) since per(1/p) equals the order of 10 mod p, but that's all you can say.
 
  • #34
So to answer the question which was "what can we say about the period pf 1/pq?" is exactly that, we can only "say". There is no exact formula for it.

We can say the period of 1/p divides phi(p) and the period of 1/q divides phi(q) because the period of 1/p is the order of 10 mod p (and for q), like you just said. So we can say that the period of 1/pq is a divisor of phi(pq).
 
  • #35
Yes, but you can also say something about per(1/pq) in terms of per(1/p) and per(1/q), namely per(1/pq) = lcm(per(1/p),per(1/q))
 

Similar threads

  • Calculus and Beyond Homework Help
Replies
16
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
544
  • Calculus and Beyond Homework Help
Replies
5
Views
280
  • Calculus and Beyond Homework Help
Replies
16
Views
2K
  • Calculus and Beyond Homework Help
Replies
25
Views
1K
  • Precalculus Mathematics Homework Help
Replies
14
Views
1K
Replies
23
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
817
  • Linear and Abstract Algebra
Replies
1
Views
782
Back
Top