In this example, the length of nonrepeating part is $2$. The length of repeating part (repeating period) is $22$.

I collected some properties related to repeating decimals.

  • The repeating period must be less than divisor.-- It doesn't give me the exact period.
  • If divisor d is a multiple of $2^m 5^n$, the length of non-repeating part of $1\div d$ is $\max(m,n)$. -- It only applies to $1\div d$.
  • If $1 \leqslant b < a$, and $a$ is not a multiple of $2$ or $5$, and $a$ and $b$ are relatively prime, then the repeating period of $b\div a$ equals $\operatorname{min}\left \{ e\in \mathbb{N}:10^e\equiv 1 \pmod{a} \right \}$. -- It has many conditions.

Without calculating the decimal, can we determine the length of the two parts of any dividend and divisor?

  • $\begingroup$ The second bullet should refer to the non repeating part. It applies as long as there are no common factors of $2$ or $5$. $\endgroup$ Dec 29, 2014 at 3:34
  • 3
    $\begingroup$ I think you are wrong about $13/92$. I think the non-repeating is $2$ and the repeating is $22$, just from experience. $\endgroup$ Dec 29, 2014 at 3:40
  • $\begingroup$ @RossMillikan you are right. Thanks for correction. $\endgroup$
    – Gqqnbig
    Dec 29, 2014 at 6:13
  • $\begingroup$ @ThomasAndrews you are right. I'm so sorry for making so many mistakes. $\endgroup$
    – Gqqnbig
    Dec 29, 2014 at 6:15

2 Answers 2


Given the reduced rational number $\frac{p}q$, you are seeking the smallest number of the form $10^n\left(10^r-1\right)$ which is divisible by $q$. Then there are $n$ non-repeating digits and $r$ repeating digits.

In particular, it only depends on $q$, not $p$ (assuming they are relatively prime.) That would make your answer for $13/92$ wrong.

So, if we write $q=2^a5^bq'$ where $\gcd(q',10)=1$, then we have $n=\max(a,b)$, and we'd have $r$ to order of $10$ modulo $q'$, which will be a divisor of $\mathbb \phi(q')$.

It is elementary if we know $n,r$ that $10^n(10^r-1)\frac{p}{q}$ must be an integer - that is the grade-school method for figuring out the value of a repeating decimal.

For example, if $p=1,q=5\cdot 37$, then $n=1$ and $r$ is the smallest value such that $10^r-1$ is divisible by $37$, which turns out to be $3$. And that's what we get: $$\frac{1}{5\cdot 37} = 0.0\overline{054}$$

Another example: $p=5,q=2^3\cdot 3\cdot 7$. Then $n=3$ and $q'=21$. That means that $r$ must be a divisor of $\phi(21)=12$. Actually, we can show it must be a divisor of $6$, and is $6$ since $1/7$ has repeating sequence of $6$. And, indeed:

$$\frac{5}{168} = 0.029\overline{761904}$$

  • 1
    $\begingroup$ What is the reduced rational number $\frac{p}q$? Is $\frac{8}{7}$ the reduced rational number? $\frac{8}{7}=1.\overline{142857}$, the length of non-repeating part is 1. But you says $q=7=2^0\times 5^0\times 7$, and n=max(0,0)=0. $\endgroup$
    – Gqqnbig
    Dec 29, 2014 at 6:26
  • 1
    $\begingroup$ Yeah, I'm only talking about $p<q$. Sorry to not make that clear. When $p>q$, you have to add the digits of $\lfloor \frac{p}{q}\rfloor$ to $n$. The $n$ I computed was the non-repeating digits to the right of the decimal. The non-repeatng digits to the left are easily computed. $\endgroup$ Dec 29, 2014 at 13:13
  • $\begingroup$ In your first example, isn't r the smallest value such that $10^1(10^r-1)$ is divisible by $37$? It seems that the two equations give the same r, can you explain why we can omit $10^n$? $\endgroup$
    – Gqqnbig
    Jan 4, 2015 at 23:32
  • 1
    $\begingroup$ Because $37$ is relatively prime to $10$. IF $a\mid bc$ and $(a,b)=1$ then $a\mid c$. @LoveRight $\endgroup$ Jan 5, 2015 at 0:23
  • 1
    $\begingroup$ For any q, we always decompose it to q' where gcd(q′,10)=1. So we only need to use $q' |10^r-1$ to find r. $\endgroup$
    – Gqqnbig
    Jan 5, 2015 at 0:30

You mean "are relatively prime" in your third point?

In general, take any non-negative rational $r = \frac{p}{q}$ such that $\gcd(p,q) = 1$.

Let $a,b,c \in \mathbb{N}$ such that $q = 2^a 5^b c$ and $\gcd(c,10) = 1$.

Then $10^{\phi(c)} \equiv 1 \pmod{c}$, by Fermat's little theorem.

Let $k = ord_c(10) = \min \{ x : x \in \mathbb{N}_{>0} \wedge 10^x \equiv 1 \pmod{c} \}$.

Then $k \mid \phi(c)$, but in general is hard to compute.

Let $m = \max(a,b)$.

Then $q \mid (10^k-1)10^m$.

Let $n = p \dfrac{(10^k-1)10^m}{q} \in \mathbb{N}$.

Let $s,t \in \mathbb{N}$ such that $n = (10^k-1)s+t$ and $0 \le t < 10^k-1$.

Then $r = \dfrac{n}{(10^k-1)10^m} = 10^{-m} ( s + t \sum_{i=1}^\infty 10^{-ik} ) $.

If $r < 1$, $r = 0.s\overline{t}$ where $s,t$ are padded with zeros if necessary to total $m,k$ digits respectively.

Now the remaining question is whether the last part of $s$ concides with the last part of $t$, which would mean that the repeat starts earlier than after $m$ decimal places. That is not possible because any repeating decimal can be expressed as a fraction with denominator of that same form (power of ten times one less than another power of ten), which would contradict the minimality of $k$ and $m$ above.

  • $\begingroup$ So k is repeating period and m is the length of non-repeating part? $\endgroup$
    – Gqqnbig
    Dec 29, 2014 at 6:36
  • $\begingroup$ @LoveRight: Yes correct for rationals smaller than 1. For rationals bigger than 1 $m$ is only the length of the part that is after the decimal point and before the repeating part. $\endgroup$
    – user21820
    Dec 29, 2014 at 7:15
  • $\begingroup$ @LoveRight: And I corrected a slight error in my answer; the order is the minimum positive natural exponent such that the power is $1$. $\endgroup$
    – user21820
    Dec 29, 2014 at 7:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .