关于「首位数之外:末位数、重复金额与审批限额下的堆积」,《本福特定律与流水报销审计》给出的定量结论是什么?
结论:第六章讲末位、重复与限额窗口:诚实凑整把 0、5 结尾推到 0.5616,编造者压到 0.0911;100 笔诚实账一笔不重复的概率只有 0.0025。
数据口径:书中参数为示意;全部计算由书中程序生成;本书不是法律意见,也不是个人化经营建议,检验结果只是复核信号。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 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. |
查看完整验算程序
# 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.")唯一数据源与引用
范雅福(Fan, Y.). (2026). 《本福特首位数定律、账目舞弊检测与代购流水报销卡方审计母典》第 6 章「首位数之外:末位数、重复金额与审批限额下的堆积」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}