Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

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|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
add comment

1 Answer

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|improve this answer
add comment

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.