Skip to main content

On My Favorite Number, 76923 (A Brief Survey of Cyclic Numbers)

(This is a cleaned-up, somewhat revised/expanded version of my Twitter thread here.)


Among math enthusiasts, the number 142857 is pretty cool. Move its leftmost digit to the right, and you get 428571, which is three times the original: 428571=142857×3. Do this again, and you get 285714, which is two times the original: 285714=142857×2. We can keep doing this until we return to 142857, as follows:

142857=142857×1142857×1=142857428571=142857×3142857×2=285714285714=142857×2142857×3=428571857142=142857×6142857×4=571428571428=142857×4142857×5=714285714285=142857×5142857×6=857142

Numbers that give you consecutive multiples when cycled as above are referred to as cyclic numbers.

If we want to be strict about it, the only nontrivial cyclic number in our usual base 10 (decimal) is 142857. However, if we relax the rules a little bit to allow for some leading zeros (i.e., zeros at the beginning), we get other interesting examples, such as 0588235294117647. I will leave it to the reader to verify that the aforementioned 16-digit number is cyclic, giving its multiples from 1 to 16 as one cycles through its digits.


Anyway, let's go back to 142857. Where else have most people seen it aside from this context? For those who have used a digital calculator with a 10-digit display, if you divide some whole number by 7 that is not evenly divisible by such, you will end up with a floating decimal part. In particular, if you divide 1 by 7, you get 1/70.142857143. This isn't quite an exact value, but it's close enough. You can get more precision by using Excel or WolframAlpha, or doing the division by hand. Then, you eventually figure out that

17=0.142857142857:=0.142857

wherein the overline indicates a string of digits that repeats infinitely.

One way to view this decimal expansion is as an infinite series: we can write

0.142857=0.142857+0.000000142857+

This is an infinite geometric series, i.e., a sum of the form a+ar+ar2+. The first term is a=0.142857 and the common ratio is r=0.000001. These series converge when 1<r<1, in which case the value of the series is a/(1r). We then have

0.142857=0.14285710.000001=0.1428570.999999=142857999999=17.

And indeed, we get that 142857×7=999999

Similarly, 1/17=0.0588235294117647, and 0588235294117647×17=9999999999999999.

The above suggests the following: cyclic numbers in base 10 are obtained by looking at the base-10 representations of 1/n for positive integers n. Now, not all values of n will give a cyclic number. For example, when n=1,2,4,5,8,10, we get a decimal representation that terminates:

11=1,12=0.5,14=0.25,15=0.2,18=0.125,110=0.1

Other times, we get short repeating blocks that are not all that interesting:

13=0.3,19=0.1,111=0.09

Sometimes we get a decimal representation that is not purely periodic, but eventually is:

16=0.16,112=0.083,114=0.0714285


Now, on to the topic at hand. Consider the expansion of 1/13=0.076923. This is purely periodic, with repeating block 076923. And, if we cycle through the digits of 076923 like we did with 142857, we get

076923=076923×1076923×1=076923769230=076923×10076923×3=230769692307=076923×9076923×4=307692923076=076923×12076923×9=692307230769=076923×3076923×10=769230307692=076923×4076923×12=923076

This is not quite a cyclic number, because the multiples are not consecutive. And if we go over the multiples that got skipped, as it turns out, they have a cool little cycle thing going on themselves!

076923×2=153846076923×5=384615076923×6=461538076923×7=534861076923×8=615384076923×11=846153

The above multiplication tables partition the positive integers from 1 to 12 into two sets: {1,3,4,9,10,12} and {2,5,6,7,8,11}. Is there anything interesting about this division?


Let's take a quick little detour for a moment. What are the possible remainders when a perfect square is divided by some given prime p? For instance, when p=3, we have 02=0 leaves a remainder of 0 when divided by 3, while 12=1 and 22=4 both leave remainders of 1 when divided by 3. However, no square leaves a remainder of 2 when divided by 3. In the parlance of number theory, we say that 0 and 1 are quadratic residues mod 3, while 2 is a quadratic nonresidue mod 3. In the case p=5, the quadratic residues mod 5 are 0,1,4; the nonresidues are 2 and 3.

Where does this question even come from, anyway? For high school students with some knowledge of number theory tricks, this can be used to determine whether or not certain equations, usually appearing in contests such as the International Mathematical Olympiad, have integer solutions. The truth is, this question is much, much more important than that. Its solution via the law of quadratic reciprocity, a theorem in which Gauss took great pride, is at the heart of what is known as class field theory; many important results in number theory arise from specific applications of this theory.

Consider now the case wherein p=13. We have

121122(mod13)224112(mod13)329102(mod13)42392(mod13)521282(mod13)621072(mod13)

As it happens, the residues mod 13 (except for 0) are precisely the ones in the 076923 cycle, while the nonresidues mod 13 are the ones in the 153846 cycle! Why is this the case?

 

Let's go back to 142857. Recall, as earlier stated, that this appears in the expansion of 1/7:

17=0.142857

If we multiply by 10, everything moves to the left, and we get what looks like a cyclic shift:

107=1.428571

To complete the cyclic shift, we lop off everything to the left of the decimal point, i.e., we subtract 1. This leaves us with

37=0.428571.

This is another way of thinking about 142857×3=428571. Rinsing and repeating gives us

307=4.28571427=0.285714.

We can do this until we go back to 1/7=0.142857.

Two observations: First, it doesn't matter in which order we perform the multiplication by 10 and removing of the integer part. For instance, we could've multiplied by 10 twice in a row to start, giving us

1007=14.28571427=0.285714.

Second, when we subtract the integer part, we are subtracting a multiple of 7 from the numerator, and in fact, the largest possible multiple of  7. What then remains is precisely the remainder when the original numerator is divided by 7.

In short, subtracting the integer part is tantamount to reducing the numerator mod 7, and so cycle shifts can just be viewed as multiplication by 10 mod 7. That is, the remainder when 101 is divided by 7 is 3, while the remainder when 102 is divided by 7 is 2. The key to 142857 giving all its multiples from 1 to 6 is precisely that each of 1,2,,6 appears as a remainder when 10n is divided by 7.

This isn't going to be the case with 13 and 076923. For one, there are 12 possible nonzero remainders, but cyclic shifts will only give us at most 6 of these. We have, proceeding as in earlier,

113=0.0769231013=0.76923010013=7.692307913=0.692307 

and so on and so forth. You don't have to start with 1, either:

213=0.1538462013=1.538461713=0.5384617013=5.384615513=0.386415 

In the language of group/field theory: if p is a prime, then the ring of integers mod p, is in fact a field, usually written as Fp; the set of nonzero elements Fp× forms a cyclic group under multiplication. That is, there is at least one nonzero a in Fp such that every nonzero element of Fp can be written as some power of a. We refer to a as a generator of Fp×, and write Fp×=a

Taking p=7, in F7, 10 is 3. We then have 31=3,32=2, and so on and so forth, until 36=1. You can verify that each of 1,2,3,4,5,6--the units of F7--appears exactly once. This tells us that 3 generates F7×. In the parlance of number theory, we say that 3 is a primitive root mod 7.

On the other hand, in F13, 10 does not generate the entire group of units F13×; for instance, 10n2 for any n. So, what could be a primitive root mod 13?

As the congruence table from earlier suggests, since 6210(mod13), we have 10=62 in F13. This suggests that 6 is a primitive root mod 13, and generates F13×. Indeed, we can verify that over n=1,2,,12, 6n takes on all values in F13×, so F13×=6.

Moreover, in F13, we have that 10n=(62)n=(6n)2, and so the numbers of the form 10n  are all perfect squares, of which there are 6. And since (n)2=n2, we get two elements of F13 mapped to the same square, so there are at most 12/2=6 distinct nonzero squares. Thus, in fact, these are all the nonzero perfect squares in F13, i.e., all the nonzero quadratic residues mod 13. As it turns out, these form a group as well; the product and quotient of two quadratic residues is also a quadratic residue. This group consists of the elements of the form 10n, i.e. it is the cyclic subgroup 10 of the larger unit group F13×.

On the other hand, the nonresidues are not a subgroup, but are the coset 610 obtained by multiplying 6 (or some other primitive root) by the above subgroup. This coset is not closed under multiplication, but it is closed under multiplication by 10, i.e., multiplying an element of this coset by 10 gives you another element in this same coset.

To conclude, notice that the period of 0.076923 is equal to 6, which is the order of the subgroup 10. This is no coincidence. Since 10 has order 6 in F13×, 6 is the smallest value of n such that 10n1 is divisible by 13, with (1061)/13=76923, or

113=769231061=0.07692310.000001=0.076923.

Going back to p=7, since 10 generates F7×, we have that 10 also has order 6 in F7×, and so 1/7=0.142857 has period 6 as well.


From the discussion above, when p is prime, 1/p yields a cyclic number if and only if 10 is a primitive root mod p. How frequently does this happen? Does it even happen infinitely often? Emil Artin conjectured, assuming that the primes behave randomly enough, that 10 is a primitive root mod p about 37% of the time. For where that figure comes from, I will defer to M. Ram Murty's exposition here.

A proof of this conjecture would hinge heavily on the assumption that the primes behave "randomly enough." Christopher Hooley gave a conditional proof that this randomness does hold, subject to the generalized Riemann hypothesis, which is an extension of a notoriously difficult unsolved problem.


Exercises

  1. By looking at the decimal expansion of n/11, verify that 9n and 9(11n) are reverses of each other for n=1,2,,10.
  2. After 17, what is the next positive integer n for which the decimal expansion of 1/n gives a cyclic number? (You might want to use a computer for this one.)
  3. Prove Midy's theorem: If p>5 is a prime and the decimal representation of a/p=0.a1a2a2k has period 2k, then
    a1a2ak+ak+1ak+2a2k=10k1. (In the above are concatenated digits, not products. For instance, with p=7,a=1, we have 1/7=0.142857 which has period 2k=6, and 142+857=999=1031.)
  4. There is no need to limit ourselves to base 10; show that the above condition for 1/p to generate a cyclic number in base 10 remains true if we replace 10 with any base b>1. Show then that for any prime number p, there is always a base b>p for which the base-b representation of  1/p generates a cyclic number.
  5. Is there a composite number n for which 1/n generates a cyclic number (in base 10 )? If so, find the smallest such; otherwise, explain why there is none. How about in other bases b?
  6. Show that if b is a perfect square, then there are no nontrivial cyclic numbers in base b.

Comments

Popular posts from this blog

A silly little derivation of ζ(2)

(This is a cleaned-up and somewhat expanded version of this Twitter thread .) What follows is a silly little proof that ζ(2)=n=11n2=π26 where ζ is the Riemann zeta function. Consider the integral I:=01log(1x+x2)x(x1)dx. We have, by using partial fractions and performing some other algebraic manipulations, I=01log(1x+x2)xdx01log(1x+x2)1xdx=201log(1x+x2)x(x1x)=2(01log(1+x)xdx01log(1+x3)xdx)=4301log(1+x)xdx(xx1/3). To evaluate this integral, we take the Maclaurin series: 01log(1+x)xdx=01n=1(1)nxn1ndx ...

On infinite decimal expansions, missing numbers, and generating functions

(This post is a cleaned up and expanded version of this thread .) A cool fact I've seen shared around the internet   a few times : The decimal expansion of 1/998001 starts with 1998001=0.000001002003996997999 That is, it begins with three-digit strings from 000 to 999, in order, except that it skips 998 for some reason. The first thing to observe is that 998001=9992. Recall the formula for the infinite geometric series: n=0rn=11r. If we differentiate both sides with respect to r, we get n=1nrn1=1(1r)2, and multiplying by r gives n=1nrn=r(1r)2. (This can also be obtained by some series manipulations.) Now, take r=0.001. We have 0.001(10.001)2=1000998001=0.001+0.000002+0.000000003+ From here, the appearance of the numbers from 001 to \( 997...

100 is the only square that is the sum of 4 consecutive (positive) cubes.

The OEIS article on the number 100  opens with an interesting factoid:  "100 is the square of 10, and the smallest square that is the sum of four [positive] consecutive cubes: 13+23+33+43=100." In fact, it is the only one. To see this, let's look at the equation y2=x3+(x+1)3+(x+2)3+(x+3)3=4x3+18x2+42x+36. Let X=4x+6,Y=4y; the above equation then reduces to Y2=X3+60X. Note that a positive integer solution in (x,y) will give a positive integer solution in (X,Y), though the converse is not true. Now, generally speaking, whenever one sees an equation of the form Y2=X3+aX+b, one has an elliptic curve . Well, we have the extra condition 4a3+27b20 to get rid of problematic cases like y2=x3, which are referred to as singular curves ; we'll see the logic of this later on. I will not go too...