There is a great wealth of mathematical fiction. There are obviously works of science fiction with a high mathematical content such as the writings of Greg Egan and Stephen Baxter. But there are popular mainstream works that have a high mathematical content too. For example the excellent The Curious incident of the Dog in the Night-Time has, among other things, some discussion of the Conway’s Soldiers problem and the plays of Tom Stoppard often have non-trivial mathematial content. But if you’d like to have a list of it all, I recently found a fairly comprehensive list of mathematical fiction: MATHFICTION.