Wednesday 13 May 2020

Reciprocals of prime numbers

On a program about Gauss (BBC In Our Time), near 48:00, they said that the reciprocal of a prime number can be a recurring decimal and the maximum length of the recurring part is one less than the number. My curiosity was aroused.

Examples are
1/7=0.142857142857142857142857142857142857...
1/59=0.01694915254237288135593220338983050847457627118644067796610169491525423728813559322033898305084745762711864406779661...
the latter was found by a VBA program which could theoretically go to 2 billion digits because that is the maximum size of an array and length of a string. However it would run out of time or memory well before it got there. Calculation the reciprocals of the numbers from 80,000-89,999 and putting them into an Excel spreadsheet found 316 reciprocals which had recurring digits one less than the number you first thought of in 7 hours 50 minutes. 89,989 is prime 1/89,989 has 89,988 recurring digits and the VBA program  took 44 seconds just to calculate that. A different programming language would be much faster.

I now have a list (in several spreadsheets) of all the reciprocals from 2 to 999,999. It is fascinating.

A 'number whose reciprocal has recurring digits one less than the number' is a bit of a mouthful, so I abbreviate it to an ##R_-## ('R minus') number. It is also useful to define a function ##R\left(n\right)## which gives the number of Recurring digits in ##n##. The VBA program calculates ##R\left(n\right)##. For ##R_-## numbers, ##R\left(n\right)=n-1## . A related function is ##U\left(n\right)## which is the number of non-recurring digits, or Unique digits, in the reciprocal. So for example we have
##R\left(7\right)=6,\ U\left(7\right)=0## and
##\frac{1}{22}=0.0454545\ldots\ \ ,\ \ R\left(22\right)=2,\ U\left(22\right)=1##

The scatter chart contains a point at ##n,R\left(n\right)## for every number from 2 to 9,999.

Given positive integers ##m,n,p## greater than 0 or 1, I have proved that
1) ##R\left(n\right)<n## for all ##n##. This is shown by the graph. There are no data points above the main diagonal line which has gradient ##~1##.

2) ##R\left(n\right)=n-1## only for prime numbers. Or only prime numbers are ##R_-## numbers.

3) ##R_-## numbers occur about 2.6 times less often than prime numbers as shown by the density of the main diagonal line.

4) For multiples of ##R_-## numbers ##n## , ##R\left(m\times n\right)## is likely to be ##R\left(n\right)##. These are shown by the less dense diagonal straight lines which have gradients 1/2, 1/3, 1/5 ....

5) ##U\left(p\times2^m\times5^n\right)=m\ or\ n## whichever is larger of ##m,n##. (We can have ##m,n=0## in this case and ##p## must not have 2 or 5 as a factor.)

6) A consequence of 5 is that two fifths of consecutive numbers have ##Q\left(n\right)=0##.

7) Another consequence of 5 is that all prime numbers, except 2 and 5, and therefore all ##R_-## numbers have no non-recurring digits.

The first two have mathematical proofs, the rest are really conjectures based on experiments with lots of numbers. The mathematical proofs are algorithmic: One thinks of how to do the calculation and that proves the result.

Here's why Reciprocals of prime numbers.pdf (11 pages)

On Gauss and me

Carl Friedrich Gauss
On the program they mention the famous story about Gauss when he was age 10 at elementary school adding up all the numbers from 1 to 100. His class was asked to do this by the teacher who, no doubt, thought she could have some quiet time while the class was busy. Gauss added the numbers up in a minute, foiling the teacher's plan. Apparently Gauss used to love telling this story.

When I was about 10 or 11 and day dreaming at school assembly, I worked out a formula for the sum of the first ##n## numbers. It is of course ##\Sigma=n(n+1)/2##. I thought I had made an fantastic mathematical and nervously went to tell Mr Fillingham, head maths teacher. He gave me a strange look and showed me the general formulas for arithmetic and geometric progressions. I was crestfallen and never repeated the story.

Gauss was given a book of logarithm tables when he was 15 and it had a list of prime numbers in the back. He said that there was poetry in the tables.

He spent so much time day dreaming about mathematics that he memorised his times tables up to very large numbers. He would have loved computers. They give you the power to play with very large sets of numbers.

No comments:

Post a Comment