Friedman's "Special Code Problem for the Student": solved
Six telegrams in an unenciphered five-figure code, sent between General SMITH and General DAVIDSON. The problem comes from William F. Friedman, Solving German Codes in World War I (Aegean Park Press), which gives no solution. It was posted to r/codes by u/kinako-san (post, 4 Dec 2026), who had worked on it for years. All 189 distinct code groups are identified, which reads all 567 groups of the six messages.
The system is a one-part code. The code-book lists its words in alphabetical order and numbers them upward, so a higher number always means a word later in the alphabet. A STOP group (45504) ends each sentence. Words not in the book are built from single-letter groups: the names S-M-I-T-H and D-A-V-I-D-SON, P-A-R-A-TROOPS, and the endings -S, -E-D, -I-N-G, -L-Y, -A-L and -E-S-T. Below, the plaintext is smoothed (suffixes joined, STOP written as a full stop). The visualizer shows the group-by-group reading.
In short
- The names are the key. Smith's messages end with five groups and Davidson's with eight, one group per letter of S-M-I-T-H and D-A-V-I-D-S-O-N. Shared letters share groups: I = 22762 and S = 40209 in both names, and D = 11719 twice. Sorting the ten letters gives the same order as sorting their numbers (A 00101 < D 11719 < H 20795 < I 22762 < M 27521 < N 30249 < O 31222 < S 40209 < T 46896 < V 50932). That is the signature of a one-part code.
- Once the code is known to be one-part, each unknown group is limited to the words that fit alphabetically between its known neighbours. The message frame came first (MESSAGE, GENERAL, STOP, SIGN-E-D, the serial numbers). The casualty list TWO KILL-E-D SIXTEEN WOUND-E-D AND SIX MISS-I-N-G came next, and the rest followed.
- Checks. All 189 readings stay in alphabetical order. Pairs of related words get nearly consecutive numbers (REPLY 38826 / REPORT 38827, ADDITION 00729 / ADDITIONAL 00730, SUPPLY 46423 / SUPPORT 46424). The group numbers also track each word's position in an ordinary English word list (Pearson r = 0.99905; see the evidence section).
- Two caveats. Group 38078 occurs only once. It is read as RECENT: it reads naturally and its position fits best, but RECEIVED remains possible. Message 6 says CANCEL OUR MESSAGE FIFTEEN, but Smith's previous message was number FIVE and Message 6 reverses it. Group 17451 (FIFTEEN) is probably a slip for 17718 (FIVE), either in the book or in the transcription.
Visualizer: rebuilding the code-book
Step through the ten stages in which the code-book was reconstructed. Groups identified at the current stage are highlighted. Click any group, in the messages or on the number line, to see its reading, how often it occurs, and its alphabetical neighbours in the code-book.
How it was solved
The problem's own hint pointed the way: it says the names SMITH and DAVIDSON are probably spelled out, letter by letter or by syllable. Without the one-part structure the remaining words would have needed far more text. With it, every new reading limits the readings of the groups around it.
Evidence that the reconstruction is right
1. Alphabetical order holds everywhere
Sorting the 189 readings by group number puts them in strict alphabetical order, from A 00101 to ZERO 53664. A one-part code gives this order automatically. Wrong guesses usually break it.
2. Related words get nearly consecutive numbers
3. Group numbers follow dictionary position
Each reading is plotted at its position in an alphabetized 60,000-word English word list, against its code number. The points fall on a nearly straight line:
Pearson r = 0.99905 (r = 0.99829 against the 235,000-word web2 list). So the code-book was numbered roughly in step with a large dictionary.
That makes position a usable test. For each group, its position between its two neighbours was predicted from the word list.
The median error was 0.034 of the gap. This test was used to choose between candidate words for the few weakly attested groups.
4. Readings that are not certain
The reconstructed code-book (189 groups)
| Group | Plaintext | Uses | Stage | Rank in 60k list | Note |
|---|
Single-letter groups found: A D E G H I L M N O P R S T V Y. The groups for B C F J K Q U W X Z (and SEVEN) never occur in the six messages, so their numbers are unknown. Their approximate place on the number line is still clear.
Encoder / decoder
Decode groups
A group not in the code-book is shown with the two known words it falls between, for example [38500: REACH…REPLY].
Encode English
The encoder works like the code clerk. It uses a word's own group if there is one. Otherwise it splits off an ending (-S, -ED, -ING, -LY…) from a known stem, and failing that it spells the word with the fewest groups. Full stops become STOP and digits are spelled out. A word that needs a letter missing from the reconstruction is flagged in red.
Source and files
- Problem: W. F. Friedman, Solving German Codes in World War I, Aegean Park Press (the poster's copy is the 1979 printing). The problem statement says the text is English, the code unenciphered, and the groups five figures each. Transcribed by u/kinako-san in r/codes 1yd0esp. (The post body was later removed; the group counts of the transcription match the headers: 121, 99, 143, 96, 41 and 67.)
- work/messages.txt: the six messages as transcribed.
- work/codebook.txt: the reconstructed code-book. results.json: code-book, counts, plaintext, statistics.
- work/steps.py: reconstruction stages and notes on uncertain groups. work/slot_test.py: the dictionary-position test. work/build_report.py: builds this page and checks it (exact coverage, alphabetical order, group counts).