Numbers dont lie and here is the proof. Simon Newcomb found out, that the position of the digit in many real-world statistics, numbers and constants obey to a specific law. He published his recognation in a paper called “Note on the Frequency of Use of the Different Digits in Natural Numbers”. Nevertheless Frank Benford was the first, that wrote an entire article about this phenomenon. The article came out in 1938 and was named “The Law of Anomalous Numbers”. Today, analysts and statisticans use Benford’s Law to detect a deception in a set of numbers.

## Validity

The law is valid for the most numbers (not for all) in this areas:

• Stock prices
• Populations (of countries, cities)
• Mathematical and physical (nature) constants
• Economic statistics
• Financial sector
• Et cetera

## Definition

Benford’s law is defined as: Benfords Law | src: wikipedia.org

n … position of d in the number

d … [0-9] as the digit

## Implementation

I started with an implementation of Benford’s Law in C. The first algorithm equals the classical Benford, which uses the summation formula.

During the test of this implementation, i noticed that the computation takes too much time. This algorithm didn’t satisfy me. After some suggestions from Prof. Dr. K. Neumann and some mathematical tricks, i tested the new Benford algorithm which uses the product formula.

This version is much faster then the first implementation. The main reason is, that the product-formula-version uses the logarithm function just with the product. Unlike the product-version, the summation-version uses the logarithm after every step.

Here you can get the source files:

• benford_sum.c
• benford_prod.c
• benford_sum.c && benford_prod.c

## More

For further information on Benford’s Law check mathpages and wolfram.

### 1 comment

XHTML: You can use the following tags:

` `

``` ```
``` ```
``` ```
``` ```
``` ```