In 1959, at the stifling, snobbish Jesuit boarding school to which my loving parents had unwisely subcontracted my care, Tom Lehrer’s songs burst upon my consciousness like a clown in a cathedral. Days there began with mass, and ended with an uplifting homily in the chapel from an elderly and skeletal priest, generally about death. “Your best friends will desert you leaving you nothing but a winding sheet,” was one of his more cheerful messages. Between the two there was catechism, rugby, occasional bullying and fairly frequent beatings.

But we had the “playroom”, where we could relax and listen to records, and one day an American boy called Ed Monaghan turned up clutching Lehrer’s first LP. It was a medicinal dose of the irreverence, nihilism and rebellion that I craved. To this day, I am word perfect in many of the songs I first heard then. There was “Poisoning Pigeons in the Park,” all about the joys of spring, and as darkly funny as its title suggests. There was the American football song “Fight Fiercely, Harvard,” which seemed to make cruel mock of those cold, dreary afternoons I was forced to spend watching my school play rugby. It was all done with such bouncing musicality that I doubt whether the Jesuits ever realized the subversive nature of what we were listening to.

Lehrer made my life bearable. I have never been able to tell him so, and it might not please him, for he has been quoted as saying: “If, after hearing my songs, just one human being is inspired to say something nasty to a friend, or perhaps to strike a loved one, it will all have been worthwhile.”

I didn’t know then that Lehrer had started out, six years earlier, by paying to have his own record cut because the record companies were shocked by his songs, and selling the LP to fellow students at Harvard. This early samizdat recording was the underground success of the decade with almost no publicity effort from Lehrer – “My songs spread slowly, like herpes, rather than Ebola,” he later recalled.

At that time, Lehrer’s principal accomplishment was that he was a mathematics prodigy who had entered Harvard aged 15, in 1943, taken a first class degree aged 18 and a master’s a year later. Born into a New York Jewish family in 1928, Lehrer had, he has said, every advantage: piano lessons, an expensive school that could get him into Harvard, and “the Broadway of Danny Kaye and Cole Porter”.

Lehrer made my life bearable.

In the next year or two, Ed Monaghan introduced me to other comedians who were turning the complacent world of American comedy on its head: Mort Sahl, Shelley Berman, Dick Gregory, Lenny Bruce. “What these so-called ‘sickniks’ dispense,” wrote Time magazine in July 1959, “is partly social criticism liberally laced with cyanide, partly a Charles Addams kind of jolly ghoulishness, and partly a personal and highly disturbing hostility toward all the world.”

But in 1960, the year after I discovered him, Lehrer stopped writing and performing, although he briefly re-emerged in 1965 to write new songs for the US version of the satirical British show That Was the Week That Was. The new songs were made into a live LP, and it was even more wonderful than the old one. They included “The Vatican Rag” – a Catholic hymn set in ragtime: “Then the guy who’s got religion’ll / Tell you if your sin’s original.” Although I was by then a confirmed atheist, I probably still thought that making fun of the Catholic church would release a thunderbolt from heaven, and “The Vatican Rag” cured me.

The album also included three songs condemning nuclear weapons. “There’ll be no more pain and misery / When the world is our rotisserie …” They were so much better than those whiny folk songs of the era, which Lehrer rather despised. “You had to admire these folk singers,” he says on the live LP. “It takes courage to get up in a coffee house or a student auditorium and come out in favor of the things everyone else is against, like peace and justice and brotherhood, and so on.”

David Frost conducts the cast of his then new show, The Frost Report, including Julie Felix and Tom Lehrer (on the piano stool), as well as Ronnie Barker, Ronnie Corbett, and John Cleese.

In this far more political new record, he satirized the Americans teaming up with West Germany against the USSR (“Once all the Germans were warlike and mean / But that couldn’t happen again / We taught them a lesson in 1918 / And they’ve hardly bothered us since then”), and was horrified that Hitler’s chief rocket scientist was now working for Washington, singing: “‘When the rockets go up who cares where they come down? / That’s not my department,’ says Wernher von Braun.”

And then he gave it up again, and he has spent the rest of his life as an obscure mathematics lecturer. He lives in the house he has occupied for decades, in Cambridge, Massachusetts, and he was 96 last month.

Years passed. I looked for Lehrer’s take on George W Bush and Tony Blair and Iraq, but had to be satisfied with a quote about how he said he didn’t want to satirize Bush; he wanted to pulverize him. Occasionally I would meet someone who loved Lehrer’s work as much as I did. Drink would be taken, a few favorites sung tunelessly but noisily.

Lehrer had started out, six years earlier, by paying to have his own record cut because the record companies were shocked by his songs.

The only one we never attempted was Lehrer’s masterpiece and his most famous song: “The Elements.” It’s simply a list of all the elements in the periodic table, sung to the tune of the Major General’s song from The Pirates of Penzance – “There’s antimony, arsenic, aluminum, selenium / And hydrogen and oxygen and nitrogen and rhenium” – and it’s virtually impossible for anyone without Lehrer’s gifts to sing it, although Daniel Radcliffe made a pretty good effort on a chatshow a few years ago. Science teachers have benefited from the many versions now available on YouTube.

Ed got back in touch toward the end of the last century, hearing that I had written a radio play about our school. I had just realized that I wanted to be a playwright when I grew up; Ed was transitioning from acting to publishing, and his last stage performance would be in a play of mine in 2012.

Then, in 2020, Lehrer put out a statement saying that he had placed everything he ever wrote in the public domain. His lyrics and sheet music are now available for anyone to use or perform without paying royalties. The statement ended: “Don’t send me any money.” This is unheard-of. Famous performers usually maximize their royalties income. In my book about the 60s, I quoted the odd line from songs by the likes of the Beatles and the Rolling Stones, and my horrified publishers took the lot out. The royalties would bankrupt them, they said.

In high excitement, I went to the artistic directors at Upstairs at the Gatehouse – the north London fringe theater that has been a home for my last two plays – and suggested I write them a show about Lehrer, weaving as many of his greatest songs into the narrative as we could. The show would ask the question that has mystified Lehrer fans for decades: what possessed him to give it all up when he was not yet 40 and at the top of his game?

Was it because, as a child mathematics prodigy, he wanted to fulfill his real vocation and become a great mathematician? Apparently not. He taught the subject, first at MIT and then at the University of California Santa Cruz – but not to mathematics majors. Instead he taught the course that humanities and social science majors have to take in the US university system. “Math for tenors,” he calls it. At Santa Cruz he also taught a course on the history of the American musical, which is one of his passions.

What possessed Lehrer to give it all up when he was not yet 40 and at the top of his game?

Was it because, as he once said, “political satire became obsolete when Henry Kissinger was awarded the Nobel peace prize”? No. Kissinger did not get the prize until 1973, by which time Lehrer had already retreated into as much obscurity as his fans allowed. But we do know that he believed satire changed nothing. He quoted approvingly Peter Cook’s sarcastic remark about the Berlin cabarets of the 1930s that did so much to prevent the rise of Hitler and the second world war.

Was it because, as he once said, he never wanted success in music? The life he wanted, he said, was that of a graduate student, and his songs were merely a way of helping to finance that. That could be part of the story, but it’s surely not the whole of it.

I researched Lehrer’s life, interviewing as many of his friends and former students as would talk to me. The historian Peter Hennessy, now Lord Hennessy, turned out to be the only person I knew who had ever met Lehrer; he interviewed him in 1970. Lehrer told Hennessy he was not doing paid performances, but had done some benefits for his leftwing Democratic congressman, Robert Drinan. Lehrer’s public persona is brittle and ironical, but Hennessy found him to be kindly and charming.”He had grown a beard and looked a little rabbinical,” Hennessy told me.

Lehrer never replied to my letters, eventually passing me a message through a roundabout route to say that he did not intend to, but was comfortable with what I was doing. Ed suggested I should call the play Tom Lehrer Is Teaching Math and Doesn’t Want to Talk to You. So I did.

But did I find the answer I sought: why Lehrer gave it all up? I am not sure. What I can tell you is that Tom Lehrer is a prodigiously talented man who has no interest at all in money for its own sake, or in money to wield power. He wants enough to be comfortable and to do the few things he wants to do, and he has that. I suspect too that, despite his protestations to the contrary, there is a serious man underneath the caustic, cynical front. He once said that you cannot be funny if you are angry. He could just about stay detached enough to be funny about Eisenhower’s America. Trying to be funny about a nation that can elect a President Trump might tear him apart.

Tom Lehrer Is Teaching Math and Doesn’t Want to Talk to You is being performed at Upstairs at the Gatehouse, in London, from May 28 to June 9

Francis Beckett is a U.K.-based author, journalist, biographer, and contemporary historian