The Prisoner of Benda

"The Prisoner of Benda" is the ninety-eighth episode of Futurama, the tenth of the sixth production season and the seventh broadcast season.

The story
According to David X. Cohen, writer Ken Keeler's Group Theorem (an actually theory, tested and proved) is used to explain a plot twist in this episode.