What does Four Pillars and Double Entry conclude, in numbers, about “How Many Orders to Re-check Each Week: Discovery Sampling and Value Strata”?
Answer: The program takes a week of 400 orders. If one order in ten is bad, 40 orders, a sample of 22 gives ninety per cent assurance of meeting at least one, and 28 give ninety-five per cent. If five in a hundred are bad, 20 orders, ninety-five per cent needs 55. With two in a hundred bad, 8 orders, it needs 124; with one in a hundred, 4 orders, it needs 211, more than half the week.
Scope of the numbers: With runnable programs this book shows that a single-entry list contains no test of itself: on an illustrative day, leave out a balance payment of 1,500.00 yuan and the spreadsheet stays perfectly consistent; a gap appears only against the bank balance. Parameters are illustrative; all calculations are generated by the book's programs; the book is general analysis, not individualised accounting, tax or legal advice.
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: 124, 20, 211, 22, 28, 40
| week of N | 400 orders; n = orders to re-check |
| bad rate bad orders n(90%) n(95%) binom(95%) | |
| 0.01 | 4 175 211 299 |
| 0.02 | 8 100 124 149 |
| 0.05 | 20 43 55 59 |
| 0.10 | 40 22 28 29 |
| at 2% bad and n | 124: P(miss all) = 0.0498 |
| none found in 124 -> fewer than 8 bad of 400 (95%, one-sided) | |
| N | 1600: 2% bad needs n(95%) = 142 |
| N | 6400: 2% bad needs n(95%) = 147 |
Show the full program
# Chapter 6. p61: how many orders to re-check by hand each week.
# Model: discovery sampling. Invariants catch balance-moving slips,
# but an entry can be internally consistent and still wrong (a cycle
# of chapter 3, a mispriced order). To see at least one such slip with
# confidence c when E of the N orders carry it, draw n orders without
# replacement: P(miss) = C(N - E, n) / C(N, n), exact with integers.
# The binomial shortcut n = ln(1 - c) / ln(1 - p), p = E / N, is
# shown beside it. N = 400 orders a week is illustrative.
from fractions import Fraction as F
from math import comb, ceil, log
def n_exact(N, E, c):
for n in range(1, N + 1):
miss = F(comb(N - E, n), comb(N, n))
if 1 - miss >= c:
return n
return N
def n_binom(p, c):
return ceil(log(1 - c) / log(1 - p))
if __name__ == "__main__":
N = 400
print("week of N = {} orders; n = orders to re-check".format(N))
print("bad rate bad orders n(90%) n(95%) binom(95%)")
for p in (F(1, 100), F(2, 100), F(5, 100), F(10, 100)):
E = int(p * N)
print("{:7.2f} {:12d} {:8d} {:7d} {:11d}".format(
float(p), E, n_exact(N, E, F(9, 10)), n_exact(N, E, F(95, 100)),
n_binom(float(p), 0.95)))
n = n_exact(N, 8, F(95, 100))
miss = F(comb(N - 8, n), comb(N, n))
print("at 2% bad and n = {}: P(miss all) = {:.4f}".format(
n, float(miss)))
print("none found in {} -> fewer than 8 bad of {} (95%, one-sided)"
.format(n, N))
for big in (1600, 6400):
print("N = {}: 2% bad needs n(95%) = {}".format(
big, n_exact(big, big // 50, F(95, 100))))Single source and citation
Fan, Y. (2026). The Conservation Algebra of Four-Pillar Settlement and Double-Entry Bookkeeping: Invariants for Error-Free Reconciliation of Buying-Agent Ledgers (Version 1.0.0), Chapter 6: How Many Orders to Re-check Each Week: Discovery Sampling and Value Strata. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-318 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026318,
author = {Fan, Yafu},
title = {The Conservation Algebra of Four-Pillar Settlement and Double-Entry Bookkeeping: Invariants for Error-Free Reconciliation of Buying-Agent Ledgers},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · What a Single-Entry List Cannot See: Conservation Tests Only Against a Count
- Chapter 2 · The Detection Matrix of Nine Error Types: What the Trial Balance Catches and What It Lets Through
- Chapter 3 · The Algebra of Location: Incidence Matrix, Null Space and the Closing Window
- Chapter 4 · Exact Arithmetic: Integer Fen, an Exchange-Difference Account and Largest-Remainder Sharing
- Chapter 5 · Accounts for a Buying Agent: Four Pillars for Every Account and Seven Daily Invariants
- Chapter 7 · Eastern and Western Sources: the Song Four-Pillar Settlement and Pacioli's Three Books
- Chapter 8 · Closing the Loop: the Daily Close, the Four-Pillar Double-Entry Reconciler and a Pre-registered Test