1

Based on experimental data, $1$ million primes, I saw that there are no primes $p$ such that the length $l$ of the period of $1/p$ is $19, 23, 24, 36, 38, 39, 47$. Further, for $19$, I have verified that there is no solution in the first $10^9$ primes.

Question 1: Are there numbers $n$ such that the period of $1/p$ is not $n$ for any prime $p$?

Related question: What is the average of ratio of the length of prime periods of $1/p$?

Source code

k = 1
p = 2
step = target = 10^6
found = False

while found == False: if p%19 == 1: d = divisors(p-1) l = len(d) i = 1 while i < l: e = d[i] if e > 19: break elif (10^e)%p == 1: print(k,p,e) break elif (10^19)%p == 1: found = True print('found',k,p,e) i = i + 1

if k &gt;= target:
    print(k,p)
    target = target + step

p = next_prime(p)
k = k + 1

Bill Dubuque
  • 272,048

2 Answers2

4

The period of $1/p$ (in base $b \geq 2$ coprime to $p$) is the multiplicative order of $b \in \mathbb{F}_p^{\times}$. Thus if $p$ is a primitive divisor of $b^n-1$ (which, by Zsigmondy’s theorem, always exists except if $(b,n)$ is $(2^t-1,2)$ or $(2,6)$), then $1/p$ has period $n$ in base $b$.

This shows that the answer to your question is “no, every period occurs”.

More generally, the only pairs $(b,n)$ such that there is no prime $p$ coprime to $b$ such that the base-$b$ expansion of $1/p$ has period $n$ are $(2,6)$, $(s,2)$ with $s+1$ a power of two, and $(2,1)$.

Aphelli
  • 34,439
  • 4
    Doesn't this show that the answer is "no"? Also, I suggest including a link to a statement of Zsigmundy's theorem. – Greg Martin Apr 01 '22 at 06:22
  • @GregMartin: I’m assuming that the OP was asking about base 10 expansion. In which case none of the exceptions apply (and they’re all sort of trivial anyway). – Aphelli Apr 01 '22 at 06:35
  • I think the point is that the question asks if there are periods that never occur; your question says "every period occurs", so the answer to the question asked is "no" rather than "yes". – Arturo Magidin Apr 01 '22 at 06:44
  • Ah, I see. Thank you for pointing this out. – Aphelli Apr 01 '22 at 06:50
2

For $19$, you didn't look far enough. Try $p=1111111111111111111$.

Why? (In response to comment.) Well, the length of the repeating part of $1/p$ is the order of $10$ modulo $p$. So we search for prime factors of $10^{19}-1$. Turns out it is just $3^2$ times $p$ above.

If we want to find $p$ such that $1/p$ has repeating part of length $n$, we can look for prime factors of $10^n-1$. Any such $p$ will have repeating length a factor of $n$, so if $n$ is prime we are guaranteed to succeed. If $n$ is composite, maybe not.

For $n=24$, calculation shows that $10^n-1$ has $10$ prime factors, and the order of $10$ is $24$ for just one of them: $1/99990001$ has period $24$. I would expect that to do this in general requires more sophisticated methods, as in @Mindlack's answer.

David
  • 82,662