Wednesday, August 21, 2013

Cyclic Primes

I mentioned cyclic primes in another blog contribution recently.

Many of their ingenious properties are to be found in that wonderful book by David Wells “The Penguin Dictionary of Curious and Interesting Numbers”.


So I will concentrate in this entry on some other interesting properties (not addressed in that book).

Clearly we operate customarily in the denary system (base 10). So full cyclic primes i.e. where reciprocals have a digital decimal period one less than the number in question) are expressed with respect to base 10.

So when we say that 7 is the first (full) cyclic prime, this is with respect to the base 10 system, where its reciprocal (1/7)  has a repeating decimal sequence of six digits (i.e. 124857). 

However the earliest base number for which 7 for example is also a (full) cyclic prime is in base 3 with the recurring digits 010212 and then again in base 5 (032412).

Then 5, which is not a cyclic prime in base 10 is however already fully cyclic in bases 2 (0011), 3 (0121), 7 (1254) and 8 (1463).

So if a prime number is not fully cyclic in base 10, it will be cyclic in a number of other bases.

In this sense a remarkable cyclic nature is shared by all prime numbers!

Incidentally 2, which is the first prime number is (fully cyclic) in base 3 (with just one repeating digit (i.e. 1). It is then fully cyclic in all odd number bases.

A simple formula can be given for the sum of digits of any cyclic prime.

If p is the prime number and n the base, then the sum of digits = (p – 1)(n – 1)/2.

So again 7 is fully cyclic in base 10. Therefore the sum of digits of its recurring period sequence = (6 * 9)/2 = 27.

Indeed this is related to another property.

Because the period (of all prime numbers other than 2) is necessarily even, we can partition the digits into two equal halves.

So with 142857 we have 142 and 857. When we add we get 999.

And this is a universal occurrence (i.e. where each digit of the sum of partitions is one less than the number base).

Now when we subdivide into smaller groups (which must be a factor) of the original partition size, the relationship likewise holds (except that we multiply by the other factor involved).

So if we partition in this case into single digit groups, this represents 1/3 of the original partition size. So the factors here are 1 and 3. Therefore when we sum the terms we get 3 * 9 = 27.   

This can be better demonstrated with respect to the recurring digit sequence of the next (fully) cyclic prime in base 10 i.e. 17.

So this has a period of 16 with the recurring digits 0588235294117647.

Now when we partition digits into two equal groups of 8 and add we get 99999999.

However we could equally partition into equal groups of 4 and add to get 2 * 9999. (The factors here are 4 and 2!)

We could the partition into equal groups of 2 and add to get 4 * 99. (The factors are now 2 and 4).

Finally we could partition into groups of 1 digit to get 8 * 9 = 72 which is necessarily the sum of digits of this cyclic prime! (The factors here are now 1 and 8). 


When one subtracts the original partition values an interesting result ensues.

So 94117647 – 05882352 = 88235295.

The first 7 digits here are a recurring sequence within the original digital sequence with the last digit 5 (representing the sum of the next 2 digits in the  full sequence (i.e. 4 + 1).

And this is a universal feature of such behaviour.

For example the 18 digits sequence for the next cyclic prime (19) is

052631578947368421.

Then, partitioning into two halves of 9 and subtracting we get,

947368421 – 052631578 = 894736843.

So once again the sub-sequence of 9 now contains 8 digits of the original sequence with the last digit (3) representing the sum of the next two digits (2 + 1) in the original sequence!

142857 * 142857 = 20,408,122,449

Wells points to the interesting fact that if we place 0 in front of the first digit we can then partition into two equal groups of 6, which when added obtains the original number 142857 (i.e. a Kaprekar number).

When we multiply 142857 by its reverse (758241) we get 108,320,034,037.

What is perhaps more surprising is that when we partition into two equal groups of 6 and add, we once more get 142857.

I say surprising, because the reverse number here 758241 does not in fact maintain the same cyclic sequence of digits!

However once again this is a property that universally holds for all cyclic primes across all bases (though not necessarily with original cyclic sequence of digits). .


Another interesting property of cyclic primes is a great regularity in the composition of digits. All the digits 0 – 9 are included before the pattern repeats.

For cyclic primes with period of (10n + 2) where n = 0, 1, 2, 3,  …., all 10 digits will appear at least n times with the two extra digits 3 and 6 occurring n + 1 times.

23 for example is a cyclic prime. This means that all 10 digits (0 – 9) will occur at least twice in the full period of 22 digits with 3 and 6 occurring 3 times.

Now cyclic primes in base 10 cannot have a period of 10n + 4 digits as this would imply that the prime ends in 5!

For cyclic primes, with period of 10n + 6 digits all 10 digits will again occur at n times with the 1, 2, 4, 5, 7 and 8 occurring n + 1 times.

Again for example 17 as we have seen is a cyclic prime. This means that 0, 3, 6 and 9 occur once with 1, 2, 4, 5, 7 and 8 occurring twice.

For cyclic primes with period of 10n + 8 digits all digits but 0 and 9 will occur n + 1 times as verified in the case of 29 (which is a cyclic prime).

This means that it is possible to immediately predict the number of times each digit occurs for any cyclic prime!

For example 47 is a (full) cyclic prime.

Therefore we know that its unique period of 46 digits contains 0, 3, 6 and 9 four times, and all the other digits i.e. 1, 2, 4, 5, 7 and 8, five times.

This of course implies that the sum of digits = (0 + 3 + 6 + 9) * 4 + (1 + 2 + 4 + 5 + 7 + 8) * 5 = 72 + 135 = 207 = (p – 1)(n – 1)/2 = (46 * 9)/2.


Here is another interesting fact related to octagonal numbers that I discovered some years ago!

The prime number 3 is cyclic in all bases 3n + 2 where n = 0, 1, 2, 3, ….

For example when n = 2 this means that 3 is cyclic in base 8, with the two digits i.e. 25 continually repeating it its decimal sequence.

Now the remarkable property of the number 25 is that when we subtract from its reverse (i.e. 52) we once again obtain 25 (in base 8).

And this property holds in all the (given) bases for which 3 is cyclic! 

In base 2, the reciprocal of 3 (as cyclic prime) has the recurring digital sequence 01

Then in base 5, it is 13, in base 8 (as we have seen) 25, in base 11 it is 37 and so on.

So for example, to move from the cyclic prime in base 5 to base 8, we multiply the first digit by 2 then subtracting 1 from the second digit, multiply by 2 and add 1.

Then in base 11 we multiply the first digit (with respect to base 5 by 3, again subtracting 1 from second digit and this time multiplying by 3 before adding 1.

Now when we convert these numbers 01, 13, 25, 37,….to base 10, we get

1, 8, 21, 40, …., which are the octagonal numbers!  

No comments:

Post a Comment