Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
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$ – Ross Millikan Jul 4 '13 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.

share|cite|improve this answer
Artin's conjecture on primitive roots implies that there are infinitely many long period primes. – lhf Jul 3 '13 at 23:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.