# Decimal expansion of 1/p, where p is prime - length of repeating sequence?

**URL:** <https://boards.straightdope.com/t/decimal-expansion-of-1-p-where-p-is-prime-length-of-repeating-sequence/685590>\
**Category:** Factual Questions\
**Created:** [April 7, 2014, 11:11pm UTC](https://boards.straightdope.com/t/decimal-expansion-of-1-p-where-p-is-prime-length-of-repeating-sequence/685590 "2014-04-07T23:11:15Z")\
**Posts on this page:** 4\
**Page:** 4

<div class="post-metadata">

**Author:** ![RayMan](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@RayMan](https://boards.straightdope.com/u/RayMan)\
**Post date:** [October 22, 2021, 5:49am UTC](https://boards.straightdope.com/t/decimal-expansion-of-1-p-where-p-is-prime-length-of-repeating-sequence/685590/62 "2021-10-22T05:49:14Z")

</div>

> [@DPRK](#):
>
> Certainly the “blue points” are arranged into their own lines. E.g. 10 1010 is a primitive root not only modulo 7 and 19 but modulo 7^k and 19^k for any k \ge 1.

Yes! If a is a primitve root modulo p^n for n \geq 2, n \in \mathbb{Z}, p \neq 2, then a is a primitive root modulo p^{n+1}. So, 10 is a primitive root modulo every prime power of 17 and 19. If p is a prime with p \nmid 10 and 10 is a primitive root modulo p^k for every k \in \mathbb{N}, then \phi(p^k)=p^k-p^{k-1}=p^{k-1}(p-1). When we plot these blue points on the graph, they will be points of the form (p^k,p^k-p^{k-1}). The slope of the line on which these points lie is:

\frac{p^{k+1}-p^k-(p^k-p^{k-1})}{p^{k+1}-p^k}=\frac{p^{k+1}-2p^k+p^{k-1}}{p^k(p-1)}=\frac{p^{k-1}(p^2-2p+1)}{p^k(p-1)}=\frac{p^{k-1}(p-1)^2}{p^k(p-1)}=\frac{p-1}{p}=1-\frac{1}{p}.

I believe there is a real consequence to this. Our good numbers (previously defined) which are full reptend primes all lie on a line of slope 1\>1-\frac{1}{p} for every p \in \mathbb{N}. _If_ in fact there exist infinitely many full reptend primes (a fact which has not been proven, but which has been proven under the assumption of a generalized Riemman hypothesis, and which is believed to be true), then for a given fixed prime p=p\_i, only finitely many numbers of the form p\_i^k are good numbers.

---

<div class="post-metadata">

**Author:** ![csstudent](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@csstudent](https://boards.straightdope.com/u/csstudent)\
**Post date:** [October 22, 2021, 7:16am UTC](https://boards.straightdope.com/t/decimal-expansion-of-1-p-where-p-is-prime-length-of-repeating-sequence/685590/63 "2021-10-22T07:16:30Z")

</div>

I’m not sure if we both understand each other here but at the moment the program I’ve written is as fast as I can make it and need it to be (although I’m sure it can be faster).

For the scope of this report, I’m just trying to reduce the list of numbers that the program needs to check for a maximal period decimal, and based on some previous posts by @RayMan I assumed that we could discard any numbers not of the form p^k.

That means what I’m trying to do at the moment is justify that assumption mathematically although I’m getting slightly confused right now as to if the assumption was correct or not.

> [@RayMan](#):
>
> In the meantime, those blue points (composite numbers) in your graph that lie above the line with slope 1/2 that we talked about: is it possible to verify whether they are all prime powers?

With regards to this question, I ran the program again for n=50000 and these are all the blue points above the line with slope 1/2.

| x | y | fac |
| --- | --- | --- |
| 49 | 42 | {7: 2} |
| 289 | 272 | {17: 2} |
| 343 | 294 | {7: 3} |
| 361 | 342 | {19: 2} |
| 529 | 506 | {23: 2} |
| 841 | 812 | {29: 2} |
| 2209 | 2162 | {47: 2} |
| 2401 | 2058 | {7: 4} |
| 3481 | 3422 | {59: 2} |
| 3721 | 3660 | {61: 2} |
| 4913 | 4624 | {17: 3} |
| 6859 | 6498 | {19: 3} |
| 9409 | 9312 | {97: 2} |
| 11881 | 11772 | {109: 2} |
| 12167 | 11638 | {23: 3} |
| 12769 | 12656 | {113: 2} |
| 16807 | 14406 | {7: 5} |
| 17161 | 17030 | {131: 2} |
| 22201 | 22052 | {149: 2} |
| 24389 | 23548 | {29: 3} |
| 27889 | 27722 | {167: 2} |
| 32041 | 31862 | {179: 2} |
| 32761 | 32580 | {181: 2} |
| 37249 | 37056 | {193: 2} |
| 49729 | 49506 | {223: 2} |

For this range, all blue points above the 1/2 line / close to the red line _are_ all prime powers.

I may have missed the explanation / not read properly but all these prime powers have not just prime bases but full repetend prime bases?

---

<div class="post-metadata">

**Author:** ![csstudent](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@csstudent](https://boards.straightdope.com/u/csstudent)\
**Post date:** [October 25, 2021, 8:26am UTC](https://boards.straightdope.com/t/decimal-expansion-of-1-p-where-p-is-prime-length-of-repeating-sequence/685590/64 "2021-10-25T08:26:49Z")

</div>

Deadline is this week so now typing up the report.

Thanks both for your help @DPRK @RayMan

---

<div class="post-metadata">

**Author:** ![csstudent](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@csstudent](https://boards.straightdope.com/u/csstudent)\
**Post date:** [November 24, 2021, 8:45pm UTC](https://boards.straightdope.com/t/decimal-expansion-of-1-p-where-p-is-prime-length-of-repeating-sequence/685590/65 "2021-11-24T20:45:34Z")

</div>

@DPRK @RayMan I got a 93, the average was 68.

Thanks both for your help.

[Previous page](https://boards.straightdope.com/t/decimal-expansion-of-1-p-where-p-is-prime-length-of-repeating-sequence/685590.md?page=3)
