What does Benford's Law and Ledger Audits conclude, in numbers, about “Beyond the First Digit: Last Digits, Repeated Amounts and Piling Up Below an Approval Limit”?
Answer: Chapter 6 covers last digits, repeats and the limit window: honest rounding lifts the share of 0 and 5 endings to 0.5616 while an inventor presses it to 0.0911, and an honest ledger of 100 rows has only a 0.0025 chance of no repeat.
Scope of the numbers: Its parameters are illustrative; all calculations are generated by its programs; the book is not legal advice and not personalised business advice, and test results are only signals for review. Marked boxes separate published evidence, runnable Python calculations (20 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.0911, 0.5616
| last-digit chi-square, df 9, 5% critical 16.919 | |
| ledger | 0/5 share gap mean chi2 flag rate |
| machine | 0.2023 +0.0023 8.7 0.036 |
| rounder | 0.5616 +0.3616 1446.9 1.000 |
| avoider | 0.0911 -0.1089 83.2 1.000 |
| a one-sided test for too few 0/5 endings clears the honest rounder; | |
| a two-sided uniformity test flags the rounder and the avoider alike. |
Show the full program
# Chapter 6. p61: the last digit fails in both directions, for two reasons.
# Three ledgers of 1000 amounts in whole yuan (10 yuan or more), 500
# ledgers each, fixed seed. Base amounts: lognormal, median 260,
# log-sd 1.2.
# machine : amounts as recorded by a till; last digit near uniform
# rounder : an honest clerk who rounds to the nearest 10 with
# probability 0.35 and to the nearest 5 with probability 0.10
# avoider : an inventor whose last digit is 0 or 5 at 0.4 weight
# Test: chi-square of the last digit against uniform, df 9, 5 percent.
# The signed gap (share of 0/5 endings - 0.2) tells which way it fails.
import math
import random
rng = random.Random(20261112)
N, REPS = 1000, 500
W_AVOID = [0.4 if k in (0, 5) else 1.0 for k in range(10)]
def gamma_q(a, x):
lead = math.exp(-x + a * math.log(x) - math.lgamma(a))
terms, t, k = [1.0 / a], 1.0 / a, 0
while t > 1e-17:
k += 1
t *= x / (a + k)
terms.append(t)
return 1 - lead * math.fsum(terms)
def crit(df, alpha):
lo, hi = 0.0, 100.0
for _ in range(100):
mid = (lo + hi) / 2
if gamma_q(df / 2, mid / 2) > alpha:
lo = mid
else:
hi = mid
return hi
def base():
return max(10, round(math.exp(rng.gauss(math.log(260), 1.2))))
def machine():
return base()
def rounder():
x = base()
u = rng.random()
if u < 0.35:
return max(10, 10 * round(x / 10))
if u < 0.45:
return max(10, 5 * round(x / 5))
return x
def avoider():
x = base()
return x - x % 10 + rng.choices(range(10), weights=W_AVOID)[0]
C9 = crit(9, 0.05)
print("last-digit chi-square, df 9, 5%% critical %.3f" % C9)
print("%-8s %9s %9s %9s %9s" % ("ledger", "0/5 share", "gap", "mean chi2",
"flag rate"))
for name, gen in (("machine", machine), ("rounder", rounder),
("avoider", avoider)):
shares, chis, flags = [], [], 0
for _ in range(REPS):
cnt = [0] * 10
for _ in range(N):
cnt[gen() % 10] += 1
chi = math.fsum((c - N / 10) ** 2 / (N / 10) for c in cnt)
shares.append((cnt[0] + cnt[5]) / N)
chis.append(chi)
flags += chi > C9
m = math.fsum(shares) / REPS
print("%-8s %9.4f %+9.4f %9.1f %9.3f" % (
name, m, m - 0.2, math.fsum(chis) / REPS, flags / REPS))
print("a one-sided test for too few 0/5 endings clears the honest rounder;")
print("a two-sided uniformity test flags the rounder and the avoider alike.")Single source and citation
Fan, Y. (2026). Benford's First-Digit Law, Ledger Fraud Detection and Chi-Square Audits of Buying-Agent Cash Flows and Expense Claims (Version 1.0.0), Chapter 6: Beyond the First Digit: Last Digits, Repeated Amounts and Piling Up Below an Approval Limit. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-216 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026216,
author = {Fan, Yafu},
title = {Benford's First-Digit Law, Ledger Fraud Detection and Chi-Square Audits of Buying-Agent Cash Flows and Expense Claims},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Where the First-Digit Law Comes From: Uniform Mantissae, Scale Invariance and Multiplicative Chains
- Chapter 2 · The Counterintuitive Claim: Invented Numbers Are Too Clean, and the Law Wrongs Honest Fixed-Price Shops
- Chapter 3 · The Chi-Square Test: the Critical Value 15.507, the False Alarms of Nine z Tests and Certain Rejection in Large Samples
- Chapter 4 · The Mean Absolute Deviation: the Noise Floor, Nigrini's Bands and the First-Two-Digit Test
- Chapter 5 · The Precondition: How Many Decades, Fixed Prices and the Mixing of Price Points
- Chapter 7 · Chinese and European Sources Weighed: the Four-Pillar Settlement, Newcomb's Logarithm Tables and Pacioli's Trial Balance
- Chapter 8 · Closing the Loop: Self-Audit of Buying-Agent Flows and Expense Claims, Red-Light Review and a Pre-Registered Plan