Definition · The secretary problem and the look-then-leap rulen candidates of distinct quality arrive one at a time in a uniformly random order. On each arrival you learn only its rank among those seen so far, and must accept or reject immediately; a rejection is final. You succeed only by accepting the best of all n.
The look-then-leap rule with parameter r rejects candidates 1 through r−1 whatever they are, then accepts the first candidate that is better than all of those — and accepts the last candidate if it reaches it. r = 1 means taking the first arrival.
Theorem · The exact success probabilityFor r ≥ 2, the rule with parameter r succeeds with probability P(r) = ((r−1)/n) × Σ 1/(i−1) summed over i from r to n. For r = 1 it is 1/n.
The argument: the rule succeeds when the best candidate is in position i ≥ r and the best of the first i−1 lies in the rejected prefix. Those are independent, with probabilities 1/n and (r−1)/(i−1). Summing over i gives the formula, and every term is rational.
The lab computes that sum as a difference of two harmonic numbers, exactly, in whole-number numerators and denominators. So the table it prints is a table of fractions rather than decimals, and the best r is whichever row holds the largest of them — a comparison between rationals, with no rounding anywhere in it.
n = 4, sum over i from r to 4 of 1/(i-1)
r = 1 P = 1/4 = 0.250000
r = 2 P = (1/4)(1/1 + 1/2 + 1/3) = (1/4)(11/6) = 11/24
= 0.458333
r = 3 P = (2/4)(1/2 + 1/3) = (1/2)(5/6) = 5/12
= 0.416667
r = 4 P = (3/4)(1/3) = 1/4
= 0.250000
the best r is 2: reject 1 candidate, then take the next record
checked by playing the rule out on all 4! = 24 orderings:
r = 1 wins 6 of 24 = 1/4 the same
r = 2 wins 11 of 24 = 11/24 the same
r = 3 wins 10 of 24 = 5/12 the same
r = 4 wins 6 of 24 = 1/4 the same
n/e = 1.4715 -- a LIMIT, held against the 1 you reject, not the best r
Four candidates and a success rate of 11 in 24, which is a little over 45 per cent, from a rule that throws the first candidate away unseen. That is the surprise the problem is famous for, and at n = 4 you can verify it by hand: there are 24 orderings, the rule is unambiguous on each of them, and counting the wins takes a few minutes.
The count, and why it is a real check
The closed form sums a harmonic series; the brute-force count plays the rule out on every permutation of the ranks and counts how often it ends with the best. The two computations share no line of arithmetic: one is a sum of reciprocals, the other is a loop over orderings comparing integers. The lab runs both for any n up to seven and compares them entry by entry, and shows the table as checked only when every entry agrees.
Example · Seven candidates, 5040 orderingsAt n = 7 the best r is 3 — reject two, then take the next record — and it succeeds with probability 29/70, about 0.414286. The counts over all 5040 orderings are 720, 1764, 2088, 2052, 1776, 1320 and 720, and every one of the seven fractions matches the closed form exactly.
Notice r = 3 and r = 4 are close: 2088 wins against 2052, which is 29/70 against 57/140. Rounded to two decimals they are both 0.41, and a page that printed decimals would be unable to say which rule was better. That is what the exact table is for.
The limit, and where it belongs
Push the candidate slider to its highest setting, a hundred, and the table is too long to print in full, so the lab shows every eighth row, the best one and the row either side of it. You reject 37, then take the first record, and that succeeds with probability 0.371043. Meanwhile n/e is 36.7879, printed rounded because 1/e is irrational — and rounded to a whole number it is 37, which is exactly how many you reject.
That looks like the constant giving the answer, so it is worth being exact about what it gave. n/e said to look near 37. It did not say that rejecting 37 beats rejecting 36 or 38; only the table does, and it says so by very little. Those are the rows r = 37, r = 38 and r = 39 — the rule’s parameter is one more than the number it rejects — and the lab prints them at 0.371015, 0.371043 and 0.370801. The winner and r = 37 agree to four decimal places and part in the fifth. Nor is the rounding dependable: walk the slider across all 98 settings it reaches and n/e rounded is the number you reject at 80 of them and one too many at the other 18.
This is the only rounded number anywhere on the course and the page labels it. The reason to keep it is that n/e is what a reader will meet everywhere else, and meeting it here as a limit sitting beside an exact table is the right way round: the table is the answer, the constant is a description of how the answer behaves for large n, and the asymptotic argument that makes it a limit is not one this path has built.
What the model left out
Every ordering is equally likely, which is the assumption doing nearly all of the work: it is what makes a record at position i mean the same thing whatever the underlying qualities were. The objective is also unusually harsh — you succeed only by getting the very best, and ending with the second best scores the same as ending with the worst. Change that to maximising expected rank and the optimal rule changes shape entirely.
And nobody can be recalled, nobody refuses, n is known in advance, and there is no cost to looking. Each of those is a modelling decision. The arithmetic here is exact and exhaustively checked, and it is exact about a situation with all four of them true.