Tom Lehrer, the Harvard-trained mathematician whose wickedly iconoclastic songs made him a favorite satirist in the 1950s and '60s on college campuses and in all the Greenwich Villages of the country, died on Saturday at his home in Cambridge, Mass. He was 97.