Let , then
(And 7a=999999. ) This seems to be an amazing property of . But then, why ? Some of you may notice that comes from the decimal expansion of . In fact:
Let’s look at the arithmetic of the long division. If we want to find the decimal expansion of , we first divide by , which gives the quotient and remainder . Then we divide by , which gives the quotient and remainder , and so on. Observe that there is a cycle of length in the sequence of the remainders: . Note that all possible non-zero remainders (i.e. ) appear and that
In other words, is a generator of the multiplicative group (the set of integers between and which are relatively prime to , or equivalently, the congruence classes of integers relatively prime to ). In this case, we say is a primitive root modulo .
Therefore, to look for a number whose expansion of has the “cyclic” property similar to that of , we have to find a such that can all be generated by (multiplicatively). Since can be generated by , is relatively prime to . But then, since all numbers between and can also be generated by , they are all relatively prime to . This shows that must be prime. In other words, we look for primes such that is a primitive root modulo .
Definition 1 Given a sequence of numbers (not necessarily distinct, and may contain ), we say is a cyclic permutation of if .
To conclude the discussion above,
Theorem 2 Let , suppose has the expansion
Then all the repetends of the decimal expansions of consist only of the cyclic permutations of if and only if is prime and is a primitive root modulo .
(So you can now show your friends the magical property of the number : etc. XD) Due to rounding of the decimals, the last digit of each line may not represent the correct digit (at this position) of the infinite expansion.
In general, it seems to be quite hard to find the primitive roots modulo , even if it has one. Note that for any prime , there must be a primitive root, since it can be shown that , the cyclic group of order . On the other hand, given a number (say ), there are methods to test whether is a primitive root modulo or not, by considering its order , which must divide by Lagrange’s theorem. (Here is the Euler’s totient function, which counts the number of congruence classes () relatively prime to . ) Notice that is a primitive root if and only if (so that it generates the whole group ). Therefore we only have to check that for all the prime factors of , . Hence the condition in Theorem 2 is equivalent to is prime and that for all prime factors of ,
Finally, we give the primitive root table (copied from Wikipedia) of all primes (and some others) less than 100:
If appears in the second column of the table, then is a primitive root modulo . For example, is a primitive root modulo the following numbers, and so these numbers display the “cyclic” property:
For example, when (the repetend has length ):