Klára Dán — esoteric intellect who wrote the first modern computer code

Every computer program running today is descended from the code Klára Dán penned more than seventy years ago. Her story deserves as much recognition as that of her husband — the polymath John von Neumann.

Klara Dan von Neumann
Klara Dan von Neumann, the writer of the world's first modern computer program. Credit: Marina von Neumann Whitman.

The post exchanges at Los Alamos were a social hub for the sprawling government complex, a cross between a department store and coffee house where people could meet for a beer or buy a new pair of shoes. A visitor in the late 1940s who dropped by there to pick up some necessity or other might have seen a woman in her thirties with brown wavy hair, smoking Lucky Strikes while scrawling neatly tabulated strings of numbers and symbols onto sheets of paper. This was Klára Dán von Neumann, known to friends and family as ‘Klári’ and her scribbles were the first complex program ever to run on a modern computer.

Born in Budapest on 18 August 1911 into a wealthy Jewish family, Dán’s home was a magnificent villa partitioned into apartments for different branches of the clan. The house was the venue for enormous gatherings of the city’s elite, where businessmen and politicians rubbed shoulders with artists and writers. Even quiet family dinners would erupt into festivities that would last all night.

Dán showed no interest in science as a child and, always painfully self-deprecating, describes herself as a ‘mathematical moron’ in her unpublished memoirs. Her first passion was figure skating and by the age of fourteen she was a national champion. Four marriages would follow — the third to Hungarian mathematician John von Neumann, the man with the world’s fastest brain.

Her first marriage, aged nineteen, was, however, to Ferenc Engel, an inveterate gambler. They lived the high life travelling from casino to casino. Dán first met von Neumann during one such trip to Monte Carlo. His fame was such that she instantly recognised him. ‘He was seated,’ she remembered, ‘at one of the more modestly priced roulette tables with a large piece of paper and a not-too-large mound of chips before him.’ He had a complicated ‘system’ but nonetheless quickly lost all his money. Her husband had drifted away to another table so she bought him a drink but at the end of the evening, they went their separate ways. Von Neumann too was married and he returned to Princeton, New Jersey where he was settling into a position at the elite Institute for Advanced Study (IAS).

Dán’s marriage, in her words ‘an absolute disaster’, would soon be over. ‘After four years of all kinds of troubles, we divorced — my father bought it for me.’ But when she met von Neumann again in the summer of 1937 in Budapest, she had remarried — to Andor Rapoch, a banker eighteen years older than she was. This time it was von Neumann’s first marriage, to his childhood sweetheart Mariette Kövesi, which was coming to an end. Kövesi, bored with her attachment to a genius who spent most of his time thinking and much of the rest of his time flitting from place to place in the service of the US military, left him for Horner Kuper, a graduate student.

When von Neumann returned, Dán wrote, ‘We struck up a telephone acquaintance, which soon turned into sitting in cafés and talking for hours, just talking and talking.’ The subject of conversation veered wildly: politics and ancient history to ‘the difference between America and Europe; the advantage of having a small Pekinese or a Great Dane’.

The exchanges between them continued in letters and telegrams after von Neumann left Budapest on 17 August. ‘It became perfectly clear that we were just made for each other,’ she recollected. ‘I told my kind and understanding daddy-husband quite frankly that nothing that he or anybody would do could be a substitution for Johnny’s brains.’

Rapoch acceded to a divorce but a mess of red tape repeatedly prevented the two of them from being wed. When France and Britain signed the Munich Agreement in September 1938, von Neumann swooped in to Budapest to marry his fiancée. Dán’s divorce came through at the end of October, and she married von Neumann two weeks later.

In Princeton, the couple settled into one of the grandest addresses in town. Their house became the setting for lavish parties that were soon the stuff of Princeton legend. With the start of war now perilously close, Dán returned to Hungary to convince von Neumann’s family and her own that they too should flee. She got them out but appears to have stayed behind to settle her family’s affairs. Von Neumann could only fret from afar. ‘For God’s sake do not go to Pest,’ von Neumann begged her on 10 August, ‘and get out of Europe by the beginning of Sept! I mean it!’

Dán sailed from Southampton on 30 August. Germany invaded Poland the next day. She arrived safely, but tragedy struck a few months later. Her father, a man of wealth and influence in Hungary, was unable to adjust to his new life. A week before his first American Christmas, he stepped in front of a train. His death plunged Dán into a black depression.

Her relationship with von Neumann was not always a consolation. He was in constant demand by the government and when she suffered a late-term miscarriage in 1942, Dán blamed him for not being at home to help her open a heavy garage door.

Von Neumann was asked to join the American atom bomb project and the ‘Fat Man’ bomb detonated over Nagasaki was built to his design. Only when the war ended did the veil of secrecy that had hung over his life lift. ‘Bring riding and skating things if possible opportunities very good,’ von Neumann cabled Dán from Los Alamos on 15 December 1945. What Dán found when she arrived must have reminded her of home. There were parties, late night poker games and a large central European contingent with many Hungarians, including von Neumann’s old friends, the physicists Edward Teller and Eugene Wigner.

Von Neumann had been fascinated with computing machines for more than a decade. A backlog of atom bomb-related calculations at Los Alamos set him off on a hunt for faster, more modern tools than even the recently arrived IBM punched card accounting machines. Still, he only learnt of the ENIAC, which would become the world’s first fully electronic computer, by accident in the summer of 1944, while waiting for a train after a meeting in Aberdeen, Maryland. On the platform was Herman Goldstine, a mathematician who was the army’s wartime liaison to the ENIAC. Goldstine took him to see the machine and von Neumann joined the project soon afterwards.

The ENIAC occupied a room that was roughly 30 feet wide and 56 feet long at the University of Pennsylvania’s Moore School of Electrical Engineering in Philadelphia. The brainchild of John W. Mauchly, a former physics teacher, and J. Presper Eckert, an electronics whizz-kid the ENIAC was built solely to compute artillery firing tables.

With von Neumann on board, proposals to build a successor to the ENIAC were quickly prepared and von Neumann tasked with finalising the team’s design for the new machine. The report he produced, the ‘First Draft of a Report on the EDVAC’, described in abstract terms the structure and components of a modern general purpose ‘stored program’ computer for the first time. After Goldstine circulated the EDVAC report widely without informing anyone, the team split. Eckert and Mauchly, who were hoping to patent aspects of computer design, were furious and left to found their own computer company.

Von Neumann secured backing for his own computer project at the IAS. That machine would roar into life in 1951. But with Los Alamos pressing him to find computational resources for their work, von Neumann hit upon the idea of converting the ENIAC into a stored-program computer. The twenty-six year old mathematician Adele Goldstine, Herman’s wife, prepared a conversion plan. But von Neumann wanted to see if someone with no mathematical background could program the machine. That person would need to be known to Los Alamos — and fit to be trusted with nuclear secrets. Who better for the task, he thought, than his wife?

‘I became Johnny’s experimental rabbit,’ Dán wrote. ‘I learned how to translate algebraic equations into numerical forms, which in turn then have to be put into machine language in the order in which the machine has to calculate it.’ In other words, she ‘became one of the first “coders”’. She described her new occupation in terms that would be familiar to many programmers today — a ‘very amusing and rather intricate jig-saw puzzle’ that was ‘lots and lots of fun’.

By the end of April 1948, the ENIAC had been converted into a stored-program computer — the first of the millions more to come. Dán’s program was the first to run on the machine in its new guise. Her code followed a nuclear chain reaction inside an atom bomb by plotting the random paths of lone neutrons hundreds of times over — a simulation that Los Alamos urgently needed to improve the efficiency of its bombs.

The first set of calculations began on 28 April and was finished by 10 May. A second set ran in October and November. Dán, together with Los Alamos physicist Nicholas Metropolis, oversaw the work, travelling solo to Los Alamos afterwards to review the calculations before the cream of the world’s physicists and mathematicians. Time on the ENIAC was precious, and the team laboured all hours of the day and night to get the job done. ‘Klári is very run-down after the siege in Aberdeen, lost 15 lbs.,’ von Neumann wrote after the first run. Despite checking in to hospital for tests, Dán wrote up a report on the conversion and use of the ENIAC that would become definitive. But the stress of defending her work before the likes of Teller and Nobel laureate Enrico Fermi, compounded by the discovery of an error in the second run, took its toll. Finding her ‘catastrophically depressed’ during a telephone call, von Neumann wrote to her, professing himself ‘scared out of my wits’ with worry. That did not stop her from returning in June the following year to complete, successfully, the third set of los Alamos problems.

Dán’s last trip to the ENIAC was in 1950. On this occasion, the job was to put Teller’s ‘Super’ or hydrogen bomb design to the test, the question being whether a fission bomb would be able to trigger a more powerful fusion device. The simulations confirmed that Teller’s assembly would not do so, and his design was abandoned. The modern ‘staged implosion’ hydrogen bombs that he and mathematician Stanisław Ulam later devised would use a very different method of ignition.

After that, Dán’s expertise was still sought out: ‘Would you look carefully to see that we haven’t done anything completely outrageous?’, asks one letter from Los Alamos. But plagued by insecurity and bouts of depression, she appears to have penned no further code herself. Los Alamos soon had its own computer, whimsically named MANIAC I and built by a team under the direction of Metropolis.

The full scope of Dán’s contributions to computing have only recently come to light, thanks to the work of historian Thomas Haigh and his colleagues. The world’s first electronic stored-program computer is usually acknowledged to be the Small-Scale Experimental Machine (SSEM) built at the University of Manchester in England. Known as the ‘Manchester Baby’, the computer ran its first program on 21 June 1948, two months after Dán’s code ran on the reconfigured ENIAC. The Manchester Baby cycled through seventeen instructions to determine that the highest factor of 262,144 is 131,072. By contrast, Dán’s 800-command program was used to adjust the composition of atom bombs. Within that program is a ‘closed subroutine’ — a type of loop that is executed whenever it is referenced from the main body of the program. The invention of the closed subroutine is generally credited to computer scientist David Wheeler, but Dán made use of one at least a year earlier than he did, to generate random numbers.

After her husband’s death, from cancer in 1957, Klári Dán von Neumann married for the fourth and last time, this time to the physicist Carl Eckart. She moved to La Jolla but could not, in the end, escape her ghosts. Her body was found washed up on Windansea Beach on 10 November 1963. She was fifty-two. Dán had filled her elegant black dress with 15 pounds of wet sand and walked into the sea.

‘Under the sunny skies of La Jolla, I swim and love,’ reads the last page of her unfinished memoirs. ‘For the first time in my life, I have relaxed and stopped chasing rainbows.’

The rainbows would prove elusive for Klára Dán but the pot of gold at the end of her own was real enough. Every computer program running today is descended from the code she penned more than seventy years ago; nearly every computer, from laptop to smartphone, is a distant relation to the one she helped rewire.

Author

Ananyo Bhattacharya