While introducing the mathematic proof in the show is cool, this exact puzzle also came up in an episode of Stargate SG-1 season 2, which predates this Futurama episode by about 10 years.
https://stargate.fandom.com/wiki/Holiday
See the last few paragraphs of the plot summary.
I wonder where and when this puzzle was first pondered? Is it a sci-fi adaption of a classical math problem?