# Why is the decimal representation of $\frac17$ "cyclical"?

$\frac17 = 0.(142857)$...

with the digits in the parentheses repeating.

I understand that the reason it's a repeating fraction is because $7$ and $10$ are coprime. But this...cyclical nature is something that is not observed by any other reciprocal of any natural number that I know of (besides multiples of $7$). (if I am wrong, I hope that I may find others through this question)

By "cyclical," I mean:

1/7 = 0.(142857)...
2/7 = 0.(285714)...
3/7 = 0.(428571)...
4/7 = 0.(571428)...
5/7 = 0.(714285)...
6/7 = 0.(857142)...


Where all of the repeating digits are the same string of digits, but shifted. Not just a simple "they are all the same digits re-arranged", but the same digits in the same order, but shifted.

Or perhaps more strikingly, from the wikipedia article:

1 × 142,857 = 142,857
2 × 142,857 = 285,714
3 × 142,857 = 428,571
4 × 142,857 = 571,428
5 × 142,857 = 714,285
6 × 142,857 = 857,142


What is it about the number $7$ in relation to the base $10$ (and its prime factorization $2\cdot 5$?) that allows its reciprocal to behave this way? Is it (and its multiples) unique in having this property?

Wikipedia has an article on this subject, and gives a form for deriving them and constructing arbitrary ones, but does little to show the "why", and finding what numbers have cyclic inverses.

• As a little aside, Devi Shakuntala notes that the number 526315789473684210 displays a cyclic property when multiplied by the integers from 2 to 18. Commented Aug 6, 2010 at 13:43
• oeis.org/A001913 Commented Nov 27, 2012 at 15:10

For a prime p, the length of the repeating block of $\frac{1}{p}$ is the least positive integer k for which $p|(10^k-1)$. As in mau's answer, $k|(p-1)$, so $k\leq p-1$. When $k=p-1$, then $\frac{1}{p}$ and its multiples behave as discussed in the question.

Of the first 100 primes, this is true for 7, 17, 19, 23, 29, 47, 59, 61, 97, 109, 113, 131, 149, 167, 179, 181, 193, 223, 229, 233, 257, 263, 269, 313, 337, 367, 379, 383, 389, 419, 433, 461, 487, 491, 499, 503, 509, 541 (sequence A001913 in OEIS).

(List generated in Mathematica using Select[Table[Prime[n], {n, 1, 100}], # - 1 == Length[RealDigits[1/#][[1]][[1]]]&].)

• After reading over this answer many times, I have finally understood it. It is short, concise, and the conditions are clearly outlined. Thank you =) Commented Jul 22, 2010 at 20:51

It works with 1/19 = 0.(052631578947368421) too, while n/13 has two cycles: 1/13 = 0.(076923), 2/13 = 0.(153846), 3/13 = 0.(230769), 4/13 = 0.(307692), 5/13 = 0.(384615), and so on.

That a cycle must appear when you have a prime number p different from the base in which we work (so in base 10 different from 2 and 5) is clear: if you perform the long division 1/p, sooner or later partial quotients must be repeated, and from that point on the quotients repeat themselves. The length of the cycle must be a divisor of p-1: it may be short (think at 1/11 = 0.(09) ) or have the maximum possible lenght like the cases of 7 and 19.

Wikipedia has an article on Cyclic numbers, and some other example is also here; unfortunately no sufficient rule is given for a number to have its inverse cyclical.

• I figured "Prime numbers that are not factors of the base" at first, but I tried the trivial counter-example (1/3), which was not cyclic. Commented Jul 22, 2010 at 7:23
• that's why I wrote that the condition is necessary but not sufficient.
– mau
Commented Jul 22, 2010 at 8:04
• Are there more necessary conditions that could be found? Perhaps it must be a prime greater than the base you are currently in (for obvious reasons). Commented Jul 22, 2010 at 19:46
• @JustinL. Clearly primes can be less than the base (which leads to true cyclic numbers that don't require prepended zeros), but also cyclic numbers do not occur when the base is a perfect square (or cube, etc.). I'm not sure if we know why. Commented May 7, 2012 at 6:18
• @MarkHurd The reptend of $\dfrac{1}{p}$ is cyclic in base $b$ if and only if $b$ is a primitive root modulo $p$. A square base $p$ cannot be a primitive root since $b^{\frac{p-1}{2}}\equiv 1\,(\operatorname{mod}\,p)$ always holds, so there are no cyclic numbers. However, per Artin's conjecture on primitive roots, a nonsquare other than $-1$ is always a primitive root modulo infinitely many primes, so there would be cyclic numbers in every nonsquare base. Commented May 16 at 20:38