# Length of recurrent strings of numbers in the decimal expansion of $1/p$, where $p$ is prime.

Am I right to assume that:

1. all rational numbers have a recurrent sequence in their decimal expansion, and

2. the length of the expansion of $1/p$, where $p$ is prime, is $p-1$ for sufficiently large $p$?

I checked it for $p= (7,) 17, 19, 23$.

I get for a decimal recurrent string of length $s$, the recurrent sequence $=a$ and the number of digits in $p=d$ is something like $\frac{1}{p}= \frac{10^{d+1}a}{(1-10^{-(s+1)}}$ but it doesn't tell me much.

• However, $\frac 1{13}$ repeats after $6$, not $12$. For a prime $p$, the repeat is a factor of $p-1$ and is the minimum number such that $10^n\equiv 1 \pmod n$ Commented Jul 4, 2013 at 4:11

The decimal expansion of a $1/p$ begins to repeat after $s$ digits and the recurrent sequence has period $t$, where $s$ and $t$ are the smallest integers satisfying $$10^s\equiv 10^{s+t}\pmod{p}.$$ In particular, we see that $s$ is always $0$ whenever $p\ne 2,5$, meaning that the repeating digits begin immediately. In this case, the problem reduces to finding the smallest $t$ such that there exists a $k\in\mathbb{Z}$ satisfying $$10^t=pk+1$$
Fermat's little theorem guarantees that $p-1$ is the largest possible $t$, but this $t$ can in fact be much smaller, and as far as I know not much can be said about the behavior of $t$ as $p$ becomes large. Primes for which the period is $p-1$, as you suggested, are called Long Period Primes. (OEIS has a few more lists of primes with periods $(p-1)/2$, $(p-1)/3$, and so on.) There does not appear to be much mathematical significance to long period primes themselves, as this depends upon our choice of base 10, but there are some related, broader questions in number theory you might study.