← Back to Portfolio

Newcomb-Benford Statistics

Newcomb-Benford Statistics
cppDec 2025Algorithm Engineer

Project Overview

A mathematical tool implementing Benford's Law (Law of Anomalous Numbers) to audit numerical datasets. It extracts the leading digits of input values and correlates their distribution against logarithmic expectations to identify evidence of data manipulation, auditing irregularities, or reporting fraud.

Key Features

  • High-speed parsing of thousands of numeric entries in text and CSV formats
  • Calculates Chi-Square and Kolmogorov-Smirnov statistical goodness-of-fit metrics
  • Generates direct ASCII bar plots representing digit frequencies vs. theoretical curves
  • Automated outlier flag highlighting digits deviating past acceptable standard deviations

Technical Challenges & Solutions

Parsing raw numbers containing formatted currencies, scientific notations, and decimal configurations. Solved by building a regex-driven parsing token system that sanitizes input numbers and isolates the first non-zero digit before casting to float.