Magic Sevenths, by Dan Kalman

Fractions vs. Decimals. With paper and pencil computation, fractions are often the simplest and most elegant way to express our results: 1/2, 1/3, 7/8. On the other hand, operations performed on a computer or calculator generally produce results in decimal form. For example, everyone recognizes that .5 and 1/2 are equivalent expressions. In some cases, an exact decimal answer requires an infinite number of digits, as in the familiar

1/3 = .3333...

Here we understand that the three dots represent and infinite string of repeating 3's. It is in this setting that the number 7 has a magical quality.

At first though, 7 just seems to be a trouble maker. To see what I mean, let's take a look at simple fractions with small denominators. Here denominator refers to the bottom number of the fraction, and we are concerned with small bottom numbers -- say nothing bigger than 10. Among these, the decimal patterns are quite simple, and readily mastered, as long as you stay away from sevenths.

For bottom numbers of 2, 4, 5, 8 or 10, the decimals always work out exactly with a finite number of digits. Indeed, the patterns of these digits are quite familiar (mostly). The case of 1/2 has already been mentioned. For a denominator of 4, we can have 1/4 =.25, 2/4 = 1/2, or 3/4 = .75, which are surely instantly recognizable to anyone who has had much occasion to handle US coins. For a denominator of 5 we get all the even tenths - .2, .4, .6, .8, while for a denominator of 10 we get both even and odd tenths.

That leaves 8. Since the even eighths all reduce to quarters, only the odd eighths remain: 1/8 = .125, 3/8 = .375, 5/8 = .625, and 7/8 = .875. These may not be the most memorable digit patterns, but working them out in your head is not hard. Thinking in terms of money, if a quarter is 25 cents, an eighth must be twelve and a half cents. That gives 1/8=.125, which can be mentally tripled to get 3/8 = .375. For 5/8 and 7/8 just add .5.

For denominators of 3, 6, and 9, we have to use infinite decimals. Several are listed below:

Here, the patterns of digits are all very simple. Once you know the decimal version of 1/3, you can double it to get 2/3, halve it to get 1/6, or divide it by 3 to get 1/9. For related fractions with the same denominators, these simple patterns reappear. The various ninths are particularly attractive: 2/9 is an infinite string of 2's; 7/9 an infinite string of 7's, and so on.

So far, we have seen simple patterns for decimals corresponding to all the small denominators up to 10, except for the case of 7. And 7 stands out like a sore thumb. Indeed, the decimal version of 1/7 is .142857142857142857... (where the block 142857 repeats forever). What a monstrousity! Whereas all the other repeating patterns above have a single repeated digit, this one has a block of 6. How are you supposed to remember that? And even if you know the pattern for 1/7, trying to double it to get 2/7 or triple it to get 3/7 will be no picnic: Quick, what is 142857 times 6???

But happily, it turns out that there is a beautiful pattern in the decimal versions for all the sevenths. Here they all are.

Do you see the pattern? Look at these decimals again, this time in a special order

Amazingly, all of these have the same 6 digits, repeating in the same order. They differ only in the starting point. So if you know the correct pattern of 6 digits for 1/7, you can figure out all the rest of the sevenths. Here is a sample calculation. Say you want the decimal for 5/7. That is 5 times the size of 1/7. Now assuming you know that 1/7 starts out .14, it is easy to see that 5/7 needs to start out close to .70. That tells us that the starting point should be .7. Then, working from the pattern 142857 for 1/7, you can see that with a starting point of 7, the block must be 714285 for 5/7.

But that is not all. There are many other interesting connections among the decimals for sevenths. Look at pairs of fractions that add up to 1: 1/7 and 6/7; 2/7 and 5/7; 3/7 and 4/7, pairs of fractions that we can refer to as twins. Notice that in each case the repeating blocks can be broken into two groups of 3 digits, and that these blocks are swapped in the decimals for each fraction and its twin. Since we know that 1/7 has the repeating block 142857, we immediately see that the block for 6/7 (the twin of 1/7) is 857142. And look what happens when you add the decimals for any fraction and its twin: you get .9999.... That is because .99999... is equal to 1 (but that is another story). And finally, in the decimal for any seventh, if you pick two digits that are exactly three digits apart, they will always add up to 9. That is, the 4th and 7th digits add to 9, as do the 5th and 8th, 6th and 9th, and 7th and 10th digits. Actually, this is just a combination of the two preceding facts. But it means that we don't really need to know all 6 digits for the decimal equivalent of 1/7. Just get the first three digits right (.142) and then subtract each of these digits from 9 to get the second half of the repeating block (857).

What is going on? Having discovered all of these interesting patterns for sevenths, two natural questions suggest themselves.

  1. Why do these patterns occur?
  2. Are there other numbers, like 7, for which similar patterns can be observed?
long division

As regards the first, much is explained by the process of long division. As illustrated in the animated graphic at left, we can obtain the decimal for 1/3 by carrying out the long division of 1.00000... by 3. At each stage of the division we bring down another zero from the decimal form of 1 and, appending it to the remainder from the previous step, divide once more by 3. For the example in the graphic, the remainder at every repetition is always the same, namely 1, and that means that every successive division by 3 looks like every preceding division, producing the same result (another 3 in the decimal at the top of the problem) and the same remainder for the next step.

Although the process for 1/3 is very simple, it reveals a pattern that occurs whenever we extract a decimal for a fraction. Any problem that eventually leads to a remainder of 0 produces a decimal that ends after a finite number of digits. The alternative is that the division problem goes on forever, without ever reaching a remainder of 0. In this case that you must eventually reach a remainder that has already been observed, and from that point on the entire process repeats.

What is more, there are a limited number of nonzero remainders available. When dividing by 7, say, the only remainders possible are 1, 2, 3, 4, 5, and 6. More generally, dividing by any whole number n can produce at most n - 1 remainders, comprising the whole numbers from 1 up to n - 1. The number of division steps between repetitions of a remainder is equal to the number of digits in the repeating block of the decimal, because each division adds one digit to the answer. When dividing by 3, there is just one remainder that occurs repeatedly, and there is just one digit that repeats in the decimal expansion. In contrast, when dividing by 7, all of the 6 possible remainders are observed, and the repeating block of the decimal has six digits. And it is this phenomenon, indicated by the occurance of every possible remainder, that accounts for the cycling digit pattern for all the fractions made up of sevenths.

The key idea is this: the pattern of the long division process for 3/7, say, is exactly the same as the pattern for 1/7 starting from the first appearance of a remainder of 3. For once a remainder of 3 is reached, the next step (dividing 7 into 3) will be just like the initial step of division for 3/7, and every successive step will therefore also agree. And this explanation shows how a similar cycling pattern can happen for other denominators. All that has to happen is for long division by such a denominator to generate all possible remainders before repeating. That also means a longest possible repeating block in the decimal form for the fraction, accounting for the fact that these denominators are referred to as being long.

If n is a long denominator, then the division process for 1/n generates all the available n - 1 remainders, and 1/n has an infinite decimal with a repeating block of n - 1 digits. Moreover, for any other fraction with denominator n, the decimal will repeat the same block of n - 1 digits, differing only in the starting point of the repetition. And that isn't all. The other pattern of twin fractions that add up to .999... also holds. From any digit d in the repeating block, if you move forward exactly half the length of that block, you will find a digit equal to 9 - d.

Are there any long denominators, besides 7? Yes. The next one is 17. Every one of the fractions 1/17, 2/17, 3/17, etc. have repeating decimals featuring a repeating block of 16 digits. In all of these decimals the repeating blocks have the same digits and the same order, differing only in where the block begins. And two digits 8 steps apart always add up to 9.

It turns out that only odd prime numbers can be long denominators. Here, a prime number is one which has no divisors other than 1 and itself. Some examples are 3, 5, 7, and 11. Not all odd primes make long denominators. Both 7 and 17 do, but 3 and 5 do not. To recognize this distinction, the primes that do make long denominators are sometimes referred to as long primes. (See The Book of Numbers by Conway and Guy.) The first three long primes are 7, 17, and 19. There are 23 odd primes between 1 and 100; 8 of them are long primes.

Modular Arithmetic and a Conjecture of Artin. Up to this point, all of the ideas have been accessible to anyone with a command of elementary school arithmetic. But it is only a small step from these ideas to some significant research questions in mathematics. For example, it is an open question whether there are infinitely many long primes, and whether they are relatively scarce or quite abundant. These questions are better understood in the language of modular arithmetic. Briefly, this is the arithmetic of a clock with a specified number of hours. The familiar example is a 12 hour clock, and the key idea is that any number can be reduced to one of the given hours by disregarding exact multiples of 12. For example, suppose you take a dose of medicine at 8 in the morning, and that you have to take another dose every 5 hours until you have consumed a total of 15 doses. We can determine the time at which the last dose is taken as follows. Compute 8+5*14 = 78. Now 72 is an exact multiple of 12, and we disregard that part of the answer. What remains is 6, and that is the time of the last dose.

Modular arithmetic can be formulated with 24 hour clocks (military time), 60 minute clocks, 7 day clocks, and indeed, with clocks having any specified set of numbers. For dividing out the decimal form of 1/7, it is convenient to think in terms of a 7-hour clock. An analysis of the long division process for 1/7 reveals that the remainders are none other than the 7-hour clock equivalants of powers of 10. The first remainder (after doing the first division) is 3, the equivalent of 10 on a 7-hour clock. The next remainder is the equivalent of 100, the next is the equivalent of 1000, and so on. The fact that all possible remainders occur in this process means that the successive powers of 10 land at every number except 7 on the 7-hour clock. Mathematicians say that 10 is a generator for the multiplicative group of integers modulo 7, or that 10 is a primitive root modulo 7. And in fact, a prime number p is long exactly when 10 is a primitive root for the integers modulo p.

In 1927, the mathematician Artin formulated a conjecture regarding the proportion of such primes. This conjecture, if true, would show that there are infinitely many long primes, and that in the long run about 1/3 of all primes are long. In fact, the conjecture goes much further, giving an exact proposed value for the proportion of long primes, and asserting that the same proportion occurs not just in base 10, but in any base whatever. This conjecture remains unproven today. It has been linked to the famous Riemann Hypothesis by a result from 1967. This shows that Artin's conjecture is a consequence of a generalized Riemann Hypothesis. As of today, no one is expecting a proof of either the Riemann Hypothesis or Artin's conjecture any time soon. So, while we know that fractions of sevenths, seventeenths, and nineteenths all have the same cycling digit patterns in their decimals, much about these numbers remains a mystery. In particular, we do not even know whether the number of long primes is finite or infinite.

So the next time you are working with decimals and fractions, remember the magical cycling patterns for sevenths. It just might save you some computational time, or at least give you a way to double check an answer. And while you are about it, take a moment to contemplate the allure of numbers, whose properties lead us from surprising patterns to deep and mysterious questions.