MathOverflow is a question and answer site for professional mathematicians. 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

Here's a question of a 'recreational' nature.

A similar question has already been posed for radix 10 in particular: Integer division: the length of the repetitive sequence after the decimal point . My question has been partly answered there; however, I'd be interested in anything further that can be added.

Suppose you have a rational number $n/d$ in simplest terms and a radix $r \ge 2$. Are there any results on the cycle length $l$ of the recurring part, and less importantly on the length of the prefix (numerals between the decimal point and the start of the recurring section)?

One result is that $l|d-1$.

I wonder whether there are simple results for various cases:

  • $r$ is a prime $p$ (such as $2$)
  • $r$ is a prime power $p^k$ (such as $16=2^4$)
  • $r$ is square-free (such as $10 = 2 \cdot 5$), i.e. $r$ is a product of distinct primes, i.e $p^2|r$ for no prime $p$
share|cite|improve this question
l divides the totient of d, which doesn't necessarily divide d-1. In any case, the form of r is irrelevant, since the answer only depends on the value of r mod d. – Qiaochu Yuan Aug 16 '10 at 23:16

Write $d=2^p 5^q m$, where $(m,10)=1$. Then the length of the prefix of $n/d$ is $\max(p,q)$. (That's for base 10, of course.)

share|cite|improve this answer

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.