关于「东西方原典考辨:宗彝丹图与高斯同余」,《校验码代数与韦尔霍夫算法》给出的定量结论是什么?
结论:《周礼·秋官》的司约把大约剂书于宗彝、小约剂书于丹图,是「按利害分配保护」的原则。程序 p71 的示意模型表明:十位号码出错率 0.00499 时,小额订单最省的是一位韦尔霍夫码(每千个 21.18 元),大额订单与汇款最省的是两位 MOD 97-10(42.44 元与 72.55 元),整号录两遍从来不划算;但宗彝防的是篡改与遗失,校验位防的是手误,二者不可互替。高斯的同余是全书算术的底座:在全部四位数金额上,弃九法对换位的检出率为 0.0000,模 11 交错和为 1.0000,任何换位都使金额变化 9 的倍数,例如 4710 写成 4170 相差 540。下一章把全书落成一套订单台流程、一个小工具和一份预注册检验方案。
数据口径:书中录入量、出错率与成本均为示意参数;全部计算由书中程序生成;本书是非个人化经营建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(19 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: -10, 0.00499, 21.18, 42.44, 72.55, 97
| cost per 1,000 codes (yuan): typing + expected loss from misses | |
| option small order large order remittance | |
| no check | 99.78 2993.26 39910.12 |
| 1 Verhoeff digit | 21.18 55.25 490.06 |
| 2 MOD 97-10 digits | 40.08 42.44 72.55 |
| typed twice | 200.05 201.49 219.91 |
| cheapest for small order | 1 Verhoeff digit |
| cheapest for large order | 2 MOD 97-10 digits |
| cheapest for remittance | 2 MOD 97-10 digits |
| slip chance of a 10-character code | 0.00499 |
查看完整验算程序
# Chapter 7. p71: great contracts on bronze, small ones on red tablets.
# The Rites of Zhou keep weighty agreements on durable ritual vessels and
# lesser ones on painted tablets. Read as an engineering rule: spend
# more redundancy where a wrong record costs more. Illustrative model:
# a code of 10 characters, each mistyped with probability 0.0005; four
# protections, each adding characters that cost 0.02 yuan of typing and
# can themselves be mistyped. Misses per 10,000 slips come from p52
# (Verhoeff, MOD 97-10); for typing the code twice, a slip escapes only
# if the second copy repeats it, put at one slip in ten being a shared
# misreading. Expected cost per 1,000 codes is printed for three tiers.
import math
CHARS, P_CHAR, COST_CHAR = 10, 0.0005, 0.02
OPTIONS = [("no check", 0, 1.0),
("1 Verhoeff digit", 1, 107.1 / 10000),
("2 MOD 97-10 digits", 2, 6.8 / 10000),
("typed twice", CHARS, 0.1 * (1 - (1 - P_CHAR) ** CHARS))]
TIERS = [("small order", 20), ("large order", 600),
("remittance", 8000)]
print("cost per 1,000 codes (yuan): typing + expected loss from misses")
print("option " + "".join("%14s" % t for t, _ in TIERS))
best = {}
for name, extra, miss in OPTIONS:
n = CHARS + (extra if name != "typed twice" else 0)
p_slip = 1 - (1 - P_CHAR) ** n
row = []
for tier, loss in TIERS:
cost = math.fsum([1000 * extra * COST_CHAR,
1000 * p_slip * miss * loss])
row.append(cost)
if tier not in best or cost < best[tier][0]:
best[tier] = (cost, name)
print("%-20s " % name + "".join("%14.2f" % c for c in row))
for tier, _ in TIERS:
print("cheapest for %-12s %s" % (tier + ":", best[tier][1]))
print("slip chance of a %d-character code: %.5f"
% (CHARS, 1 - (1 - P_CHAR) ** CHARS))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《校验码代数与二面体群韦尔霍夫算法、订单号汇款码书号单字误抄与相邻换位检出率母典》第 7 章「东西方原典考辨:宗彝丹图与高斯同余」(版本 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}
}