found correspondence that Robert Patterson, a mathematics professor at the University of Pennsylvania, wrote to Thomas Jefferson in December 1801. By then, Jefferson was president of the United States. Both Patterson and Jefferson were officials at the American Philosophical Society, a group that promoted scholarly research in the sciences and humanities. Both were also enthusiasts of ciphers and codes, regularly exchanging them. Patterson wrote, “The art of secret writing has engaged the attention both of the statesman and philosopher for many ages.” But Patterson noted that most ciphers fall “far short of perfection.” For Patterson the perfect code came with four properties: (1) It should be adaptable to all languages; (2) be simple to learn and memorize; (3) easy to read and write; and (4) most of all, “be absolutely inscrutable to all unacquainted with the particular key or secret for deciphering.”
Patterson included with his letter an example of a cipher so difficult to decode that it “would defy the united ingenuity of the whole human race.” Bold words from a man of the 19th century, but that was before the existence of high-speed computer algorithms.
Patterson made the task especially difficult, explaining in his letter that, first, he wrote a message text vertically, in column grids, from left to right, using lowercase letters or spaces, with rows of 5 letters. He then added random letters to each line. To solve the cipher meant knowing the number of lines, the order in which those lines were transcribed, and the number of random letters added to each line.
Here are the letters from Andrew Jackson’s message:
The key to deciphering this code is a series of two-digit number pairs. Patterson explained in his letter that the first digit of each pair indicated the line number within a section, the second digit the number of letters added to the beginning of that row. Of course, Patterson never revealed the number keys, which has kept his cipher unsolved for 175 years. To discover this numeric key, I analyzed the probability of diagraphs. Certain pairs of letters simply do not exist in English, such as dx, while some almost always appear together, such as qu. To ascertain a sense of language patterns for Patterson and Jefferson’s time I studied the 80,000 letter characters contained in Jefferson’s State of the Union addresses and counted the frequency of diagraph occurrences. I then made a series of educated guesses such as the number of rows per section, which two rows belong next to one another, and the number of random letters inserted into a line. To vet these guesses I turned to a computer algorithm and what’s called dynamic programming, which solves massive problems by breaking the puzzle down into component pieces and linking the solutions together. The overall calculations to analyze were fewer than 100,000, which is not all that tedious. It’s important to note that the programs available to me are not available to the general public, which might explain why the cipher has remained unbroken. After a week of working the code, the computer discovered the numerical key.