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

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.

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.

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?

Deadline is this week so now typing up the report.

Thanks both for your help @DPRK @RayMan

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