A Futurama Math Conversation with David X Cohen:
The Fermat’s Last Theorem joke first appeared in the [Simpsons] 3-D Halloween episode Homer3, and I got the idea that I could come up with a near-counterexample to Fermat’s Last Theorem that is accurate enough that if you test it on a bad calculator, it would appear to be true, and it would drive people crazy.