https://github.com/argentini/argentini.benford
Experiment with Benford's Law to find data anomalies in number lists and images (Windows, macOS, Linux, .NET 8.0, x64, Arm64, Apple Silicon)
https://github.com/argentini/argentini.benford
analytics anomalous-numbers benfords-law dotnet fake fraud normal-distribution numbers patterns
Last synced: 7 months ago
JSON representation
Experiment with Benford's Law to find data anomalies in number lists and images (Windows, macOS, Linux, .NET 8.0, x64, Arm64, Apple Silicon)
- Host: GitHub
- URL: https://github.com/argentini/argentini.benford
- Owner: argentini
- License: mit
- Created: 2022-05-27T15:03:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-03T15:38:42.000Z (about 1 year ago)
- Last Synced: 2025-04-01T22:46:51.944Z (8 months ago)
- Topics: analytics, anomalous-numbers, benfords-law, dotnet, fake, fraud, normal-distribution, numbers, patterns
- Language: C#
- Homepage: https://nonsequiturs.com/
- Size: 1.85 MB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# What is Benford’s Law?
We all know about the [Normal distribution](https://en.wikipedia.org/wiki/Normal_distribution) and its ubiquity in all kind of natural phenomena or observations. But there is another law of numbers which does not get much attention but pops up everywhere — from nations’ population to stock market volumes to the domain of universal physical constants.
**Benford’s Law**, also known as the **Law of First Digits**, the **Phenomenon of Significant Digits**, or the **Law of Anomalous Numbers** is the finding that the first digits (or numerals to be exact) of the numbers found in series of records of the most varied sources do not display a uniform distribution, but rather are arranged in such a way that the digit “1” is the most frequent, followed by “2”, “3”, and so in a successively decreasing manner down to “9”.
The distribution of first digits should follow the pattern in the image below:

This distribution is specifically:
```
Digit Benford [%]
===== ===========
1 30.10
2 17.61
3 12.49
4 09.69
5 07.92
6 06.69
7 05.80
8 05.12
9 04.58
```
## Project
This project is a .NET console app project to play with Benford's Law on images and a text file with numeric values. You can fill the text file with a large, random data set from most any source to see if the data follows this law and if not, implying the data has been artificially altered. Likewise you can put a set of images (*.jpg, *.tiff) into the *images* folder to analyze the pixel values in them. If the image results deviate from the law it could mean the image has been processed or altered.