TITLE: New mathematical results in fiction work
QUESTION [13 upvotes]: On the surreal numbers page on Wikipedia it says:

They were introduced in Donald Knuth's 1974 book Surreal Numbers: How Two Ex-Students Turned on to Pure Mathematics and Found Total Happiness. This book is a mathematical novelette, and is notable as one of the rare cases where a new mathematical idea was first presented in a work of fiction. 

I would like to know if there are more fiction books that introduced new mathematical ideas, or even if they're not fiction, just books that introduced new things without being a formal mathematics textbook.  For example I know Gödel, Escher, Bach introduced a few new things about non-linear recursive functions.
Does anybody know more examples?

REPLY [6 votes]: To flesh out Potato's comment, the Futurama episode "The Prisoner of Benda" presents a scheme for crafting any permutation on an (ordered) set $A$ through a series of unique swaps of elements of $A$ with two additional elements $x$ and $y$.  (Two additional elements are needed, since otherwise after the first swap $(x, a_0)$ of the extra element $x$ with some element $a_0\in A$, at some point another swap $(x, a_0)$ would need to be made to put $x$ back where it started.)  The theorem isn't particularly deep (it is, as the creator notes, closer to an algorithm), but it doesn't appear to have been explicitly stated previously.