关于「订单号、汇款识别码与内部书号:一个月的账」,《校验码代数与韦尔霍夫算法》给出的定量结论是什么?
结论:按示意参数,每月 20,000 次人工录入、出错率 0.00625、拦下一笔 2 元、漏过一笔 150 元:没有校验位每月损失 18750 元,EAN 式 794 元,Luhn 633 元,韦尔霍夫 448 元,达姆 446 元,两位 MOD 97-10 为 263 元。换位占比从 0.05 升到 0.30,EAN 的漏检从 236.4 升到 514.2,韦尔霍夫保持 107.1。模拟录入员与穷举相符;伪造者 1000 个编造的号码全部合法,盲猜也有 0.0995 通过,校验位只防误抄,不是安全凭证。订单号、汇款识别码与内部书号分别用韦尔霍夫一位、MOD 97-10 两位与达姆一位。下一章回到原典:《周礼》把大约剂书于宗彝、小约剂书于丹图,高斯写下同余,它们各自说对了什么。
数据口径:书中录入量、出错率与成本均为示意参数;全部计算由书中程序生成;本书是非个人化经营建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(19 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: -10, 0.05, 0.30, 107.1, 18750, 20000
| entries 20000, slips 125 a month (illustrative) | |||
| scheme | missed/month | caught/month | cost (yuan) |
| none | 125.00 | 0.00 | 18750 |
| Luhn | 2.59 | 122.41 | 633 |
| EAN 1,3 | 3.68 | 121.32 | 794 |
| Verhoeff | 1.34 | 123.66 | 448 |
| Damm | 1.32 | 123.67 | 446 |
| MOD 97-10 | 0.09 | 124.92 | 263 |
| adjacent-swap share Luhn EAN 1,3 Verhoeff (misses/10,000) | |||
| 0.05 | 195.6 | 236.4 | 107.1 |
| 0.10 | 206.7 | 291.9 | 107.1 |
| 0.15 | 217.8 | 347.5 | 107.1 |
| 0.20 | 228.9 | 403.0 | 107.1 |
| 0.30 | 251.2 | 514.2 | 107.1 |
查看完整验算程序
# Chapter 6. p61: what a check digit is worth in a month of manual entry.
# Illustrative shop: 20,000 references typed by hand per month, one in
# 160 typed wrongly (0.00625), Verhoeff's error spectrum. A slip caught
# at entry costs a re-type (2 yuan of time); a slip that slips through
# costs a mis-posted remittance or order (150 yuan of tracing and
# refunds). Misses per 10,000 errors are the full-spectrum totals of
# p52. Part two moves weight between single errors and adjacent swaps,
# holding the other classes fixed, to see when the choice matters.
import math
ENTRIES, ERR_RATE = 20000, 0.00625
COST_CAUGHT, COST_MISSED = 2, 150
P52 = [("none", 10000.0), ("Luhn", 207.2), ("EAN 1,3", 294.3),
("Verhoeff", 107.1), ("Damm", 106.0), ("MOD 97-10", 6.8)]
errors = ENTRIES * ERR_RATE
print("entries %d, slips %d a month (illustrative)" % (ENTRIES, errors))
print("scheme missed/month caught/month cost (yuan)")
for name, per in P52:
miss = errors * per / 10000
caught = errors - miss
cost = math.fsum([miss * COST_MISSED, caught * COST_CAUGHT])
print("%-10s %12.2f %13.2f %12.0f" % (name, miss, caught, cost))
# 第二部分:单字错与相邻换位此消彼长(其余类别计数不变)
SINGLE, ADJ, REST = 9574, 1237, 12112 - 9574 - 1237
# 各方案对相邻换位的检出率(p12),以及其余类别的漏检数(p52 推得)
ADJ_RATE = {"Luhn": 88 / 90, "EAN 1,3": 80 / 90, "Verhoeff": 1.0}
REST_MISS = {"Luhn": 207.2 * 12112 / 10000 - ADJ * (1 - 88 / 90),
"EAN 1,3": 294.3 * 12112 / 10000 - ADJ * (1 - 80 / 90),
"Verhoeff": 107.1 * 12112 / 10000}
print("adjacent-swap share Luhn EAN 1,3 Verhoeff (misses/10,000)")
for share in (0.05, 0.10, 0.15, 0.20, 0.30):
adj = share * 12112
row = []
for name in ("Luhn", "EAN 1,3", "Verhoeff"):
m = math.fsum([adj * (1 - ADJ_RATE[name]), REST_MISS[name]])
row.append(m / 12112 * 10000)
print(" %.2f %6.1f %7.1f %8.1f" % (share, *row))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《校验码代数与二面体群韦尔霍夫算法、订单号汇款码书号单字误抄与相邻换位检出率母典》第 6 章「订单号、汇款识别码与内部书号:一个月的账」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-297 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026297,
author = {Fan, Yafu},
title = {The Algebra of Check Digits and Verhoeff's Dihedral-Group Code: Detection Rates for Single-Digit Slips and Adjacent Transpositions in Order, Remittance and Book Numbers},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}