Anand CV Mallaya

Archive for May, 2012|Monthly archive page

Benford’s law applied to Prime numbers

In math on May 27, 2012 at 6:22 pm

Benford’s law is one of the many amazing laws regarding numbers. Benford’s law, also called the first-digit law, states that in lists of numbers from many (but not all) real-life sources of data, the leading digit is distributed in a specific, non-uniform way. It says that in many large data sets, the digit ‘1’  appears as first digit for a significant 30.1% times, ‘2’ for 17.6%, 3 for 12.5%, 4 for 9.5%, 5 for 7.9%, 6 for 6.7%, 7 for 5.8%, 8 for 5.1% and digit 9 for 4.6%. Below is the Benford’s distribution(Image courtesy Wikipedia).

A sequence of decreasing blue bars against a light gray grid background.

It is obvious that the percentage reduces in a power law as the digit grows bigger(power law).

This is observed in many natural accounting data, election data, genomic data etc.

Here is an attempt to look at my favorite list of numbers using this law. Both for fun as well as for exploratory purpose.

I have done the following in a math tool to generate prime numbers less than 1000000 and then counted the first digit of each prime number and plotted in a bar chart. The plot is given below.

Plot of First digit distribution of Prime Numbers
Clearly, though there are somewhat appearance of a power law distribution, it is nowhere near Benford’s distribution.There goes my search for patterns in prime numbers to the next stage.