New mathematical results in fiction work 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?
 A: 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.
A: Soddy's "The Kiss Precise" 

Frederick Soddy rediscovered [Descartes'] equation in 1936. The kissing circles in this problem are sometimes known as Soddy circles, perhaps because Soddy chose to publish his version of the theorem in the form of a poem titled The Kiss Precise, which was printed in Nature (June 20, 1936)  

and its kissing cousins, the higher dimensional extensions also in verse:
http://www.pballew.net/soddy.html
A: Some large integer almost-solutions of Fermat's Last Theorem first appeared in The Simpsons.  
http://en.wikipedia.org/wiki/Fermat%27s_Last_Theorem_in_fiction

in an episode of The Simpsons, "Treehouse of Horror VI" ..... the equation 1782^{12} + 1841^{12} = 1922^{12} is visible, just as the dimension begins to collapse. The joke is that the twelfth root of the sum does evaluate to 1922 due to rounding errors when entered into most handheld calculators ..... it actually is 1921.999999995. A second 'counterexample' appeared in a later episode, "The Wizard of Evergreen Terrace": 3987^{12} + 4365^{12} = 4472^{12}. These agree to 10 of 44 decimal digits, 

