Fractional Graphs and Flowers
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
It is common knowledge that every rational number (fraction) can be written as a repeating or terminating decimal. This Demonstration shows a colorful visualization of repeating expansions of rational numbers, highlighting the cycles. Choose the denominator and base with the sliders. Each view shows all (proper) fractions at once. In "flower" mode, first find the red numerator—the numerators are arranged in order counterclockwise around the circle. The first digit of the expansion is the black circled number. Then follow the arrows to find the successive digits. In "graph" mode, disconnected cycles are more clearly separated. (Terminating decimals are shown as a cycle of repeating 0s.)
Contributed by: Kenneth E. Caviness and R. Lewis Caviness (March 2011)
Open content licensed under CC BY-NC-SA
The patterns of repeating decimals have intrigued elementary school children and professional mathematicians alike, raising questions that lead to regions of mathematics as far-flung as modular arithmetic, number theory, and group theory –. The fractional flower representation offers an aesthetic and convenient way to treat decimal (and other base) expansions of rational numbers.
We appreciate the many strong conclusions that others have drawn by assuming that the fractions are reduced to their simplest form, where the numerator and denominator are relatively prime. But here we include all fractions with the same denominator together in each flower or graph in order to visualize the larger inherent symmetry of the entire fraction family.
Snapshot 1: the fractional flower, showing the cycle of digits of all sevenths
The decimal expansions of the (proper) sevenths fractions is a good example and was the original impetus for our interest in these patterns: , , , , , and —all exactly the same digits in the same order, merely starting the cycle at a different point.
Snapshot 2: a fraction graph with cycles of period 6, 3, 2, and 1
For base-10 fractions, the fractions that have perfectly cyclic expansions are exactly those which when reduced to lowest terms have denominator relatively prime with respect to 10. If the (reduced) denominator is some multiple of powers of 2 and 5, the decimal expansion terminates (or equivalently, becomes a cycle of 0). Other denominators result in expansions with a non-repeating part before the repeated segment (known as the repetend or repunit). These are shown in "flower" mode by pink circles and arrows leading into one of the repeated cycles. Cycles of period 1 are shown in red, other distinct cycles are shown in different colors for convenient identification. It may amuse the reader to try to predict the number and length of the cycles for various denominators.
Snapshot 3: the fractional flower, showing nonrepeating lines that feed into the 0-cycle; feeder lines appear in all fractional flowers where the denominator and base have common factors greater than 1, that is, if
At each step in the long-division process the remainder obtained precisely defines the sequence of quotient digits that appear from that point on. Trivially, a remainder of 0 guarantees 0s in the expansion from then on. But in all cases the remainder defines the rest of the expansion. For example, when dividing by 7, a remainder of 1 guarantees that the rest of the digits will be same as the expansion of 1/7. Since the only possible remainders are 0, 1, …, 6, in at most 7 steps a repeat remainder will occur. (See "Pigeonhole Principle" in the related links.) But the length of the repetend, called the period of the expansion, cannot equal the denominator since this would mean that one of the remainders was 0, and the repetend would then necessarily be 0 (and thus have period 1). It follows that the period of a fraction with denominator can be at most , and indeed, in the case of the sevenths fractions the period is 6. It has been shown (–) that the period must be a factor of if and the base (normally 10) are relatively prime. The user can easily change bases with the slider and notice that the periods of all cycles are factors of . (Which factor is a more complicated issue, extensively treated in .)
Snapshot 4: the fractional flower (in base 10), showing two distinct cycles of period 6 (and the 0-cycle)—but in other bases this has one cycle of period 12, three cycles of 4, four cycles of 3, six cycles of 2, and even all cycles of period 1; switch between "graph" and "flower" modes to easily identify cycles and see their symmetries
Snapshot 5: a fractional flower having only cycles of period 1, the typical behavior when the denominator is one less than the base:
Snapshot 6: the six period-2 cycles of fractions, where the repetends are all multiples of 9: 9, 18, 27, …, 81, 90
As was noted as early as 1802 by H. Goodwin and proven in 1836 by the French mathematician E. Midy, under certain conditions the repetends in decimal expansions can be divided in half and added together to give 9, or 99, or 999, etc. In base 10, for elevenths this is immediately obvious: 0 + 9 = 9, 1 + 8 = 9, etc. For sevenths, we have 142 + 857 = 999, for thirteenths, 076 + 923 = 999, and 153 + 846 = 999. See references – for proofs of this behavior (called the Midy property, "the nines property", or "complementarity" by various authors) and extensions of it.
The fractional flowers in this Demonstration provide a powerful way to consider the Midy property: symmetry. All of the images show a high degree of vertical symmetry (reflection across the axis, shown here by a dotted gray line): this symmetry is exhibited by the cyclic paths, by the red digits (numerators) and by the circled black digits (quotient digits, digits of the expansions). An expansion with the Midy property traces out symmetric cycles between nodes that pairwise total to 9 (or more generally, to when represented in base ) and appear as vertical "complementary reflections" of each other across the central horizontal axis. Other symmetries may also easily be discovered and studied as well.
We leave to the interested user the following questions to consider, some of whose answers are in the references, while others remain open:
1. True or False? The cycles are pure (no feeder lines) if and only if and are relatively prime.
2. True or False? There are only feeder lines and one cycle of period 1 if and only if .
3. True or False? There are cycles of period 1 if and only if .
4. True or False? There are 1 or 2 cycles of period 1 and all other cycles have period 2 if and only if .
5. True or False? If the prime factorizations of and include exactly the same prime factors (but not necessarily with the same exponents), all paths lead to 0.
6. If is a composite number, can you deduce its fractional flower from those of its factors?
7. If is a composite number, can you deduce the period of the cycle(s) of from the periods of the cycles of the inverses of its factors?
8. Under what conditions is there one maximal length cycle (with period )?
9. Find a fractional flower with cycles that are not vertically symmetric: Why does Midy's theorem not apply in these cases? (Note that the entire pattern is vertically symmetric, but in some cases individual cycles are not.)
10. True or False? The set of all feeder lines of a fractional flower always exhibits vertical symmetry.
11. In cases where there are cycles with various periods for a given denominator and base, what distinguishes between them?
12. Under what conditions does a fractional flower exhibit both horizontal and vertical symmetry?
13. When does a fractional flower have symmetry under a rotation by some angle? (The family in base 10 has rotational symmetry, looking the same after a rotation of . Many others can be rotated by , , or .)
14. Within the fractional flower pattern, how do the cycles of and compare (like 4/13 and 9/13, for example)?
Connections to Group Theory:
Another interesting representation of repeating decimal expansions is the "remainder wheel" or "decimal clock" , , mimicked to a certain extent by our "graph" mode, although neither reveals the symmetries inherent in the fraction families. (See "Quotients and Remainders Wheel" in the related links.) This view is instigated by the group-theoretic consideration of decimal expansions, considering the remainders (shown in red in both "flower" and "graph" modes) as the elements of the multiplicative group . If and are relatively prime, there is some power of congruent to 1 (mod ). Then the cycle containing 1 is the cyclic subgroup .
(This cycle can be read from the fraction flower or fraction graph by finding the red 1 and following the arrows until the cycle is complete.)
This cyclic subgroup , together with any other (nonzero) cycles of remainders form cosets modulo and are members of the factor group .
(The set of cosets can be formed by multiplying by any element r of —yielding either itself or a coset , where is not an element of —and then eliminating any duplicates.)
By Lagrange's theorem the order (or size) of a finite group is divisible by the order of any of its subgroups, and thus is divisible by . The smallest positive integer such that is called the multiplicative order of ), and for and relatively prime, is the period of the decimal expansion of —and of for and relatively prime.
(See also the related links for Euler totient function , primitive roots, and Fermat's little theorem.)
Example: , : . The first element of not in this set is : . In this case and are the only distinct cosets, and the factor group is isomorphic to .
Example: , :: only one cycle.
And finally, two last questions:
15. What goes wrong with this coset production if and are not relatively prime? (Try it!)
16. How can the varying sizes of the cycles be explained? For example, the thumbnail figure shows and , and snapshot 2 shows and . Since in both cases and are relatively prime, we can generate the cyclic subgroup , and its order must divide . is easy to identify as one of the large cycles of remainders shown in the fraction flower or graph. But again, why don't all the cycles of remainders have the same size?
 T. Bassarear, Mathematics for Elementary School Teachers, Boston, MA: Houghton Mifflin, 1997.
 M. Gardner, Mathematical Circus, Washington, DC: Mathematical Association of America, 1992.
 M. W. Ecker, "The Alluring Lore of Cyclic Numbers," Two-Year College Mathematics Journal, 14(2), 1983 pp. 105–109.
 W. G. Leavitt, "Repeating Decimals," College Mathematics Journal, 15(4), 1984 pp. 299-308.
 D. Kalman, "Fractions with Cycling Digit Patterns," College Mathematics Journal, 27(2), 1998 pp. 109–115.
 L. Brenton, "Remainder Wheels and Group Theory," College Mathematics Journal, 39(2), 2008 pp. 129–135.
 G. Garza and J. Young, "Wieferich Primes and Period Lengths for the Expansions of Fractions," Mathematics Magazine, 77(4), 2004 pp. 314–319.
 E. Midy, De Quelques Proprietés des Nombres et des Fractions Decimales Periodiques, Nantes, France, 1836.
 Midy's theoremon Wikipedia.
 B. D. Ginsberg, "Midy's (Nearly) Secret Theorem: An Extension after 165 Years," College Mathematics Journal, 35(1), 2004 pp. 26–30.
 M. Shrader-Frechette, "Complementary Rational Numbers," Mathematics Magazine, 51(2), 1978 pp. 90–98.
 J. Lewittes, "Midy's Theorem for Periodic Decimals," Integers: Electronic Journal of Combinatorial Number Theory, 7, 2007 # A02.