When Abby and Tim play the "Elements Song," they attribute it to a famous mathematics professor who penned it in the 1950s. In reality, the melody is a standardized theme used repeatedly in almost all of the British "Gilbert & Sullivan" operas from the late 1800s to the early 1900s. It is widely accepted in academic circles that the math professor, who was a real person, specifically utilized the tune for memorization purposes.
The Elements Song was written by Tom Lehrer, who wrote many excellent comic songs. And the tune used by Lehrer is the Major General's song from Pirates of Penzance, one of many very different comic baritone songs written by Gilbert and Sullivan.