Von Neumann’s first computer program

What would you do with a brand-new computer of unprecedented capabilities? Ada Lovelace demonstrated the theoretical capabilities of Babbage’s Analytical Machine with a program to compute Bernoulli numbers (1843). J. Presper Eckert and John Mauchly’s first program for ENIAC was a ballistics calculation (1946). Alan Turing used the Manchester Mark 1 to compute Mersenne primes (1949). When John von Neumann had the chance to explore the abilities of ENIAC’s successor, EDVAC, he focused on something quite different: data sorting.

Donald Knuth wrote a fascinating 1970 paper, “Von Neumann’s First Computer Program,” which analyzes the original 23-page handwritten document where von Neumann recorded his planned program. Von Neumann conceived of a merge sort algorithm and wrote out an implementation of the merge part of it, which Knuth examined and reported on. Knuth noted the insights von Neumann achieved and then respectfully, humbly, pointed out places where von Neumann’s code could be optimized as well as an unfortunate bug in the program. As Knuth noted, not bad for programming without having the actual machine yet to test it! (I do not know how Knuth found the error, whether by hand-examination or by running the program through a simulator.)

There were some very pressing reasons why ballistics and numerical simulations were the top priorities for the electronic computers just coming into existence in the late 1940’s. Von Neumann’s foray into “a nonnumeric application for computers” foreshadowed the generation and growth of information processing and a landslide of other associated activities and applications in use throughout the world today.