Fourteen years after its premiere, Futurama has finally come to to an end – again. After four seasons of neglect on the FOX network, the brilliant animated sci-fi comedy was cancelled in 2003, then rode a wave of fan goodwill to resurrection in a series of DVD movies and two seasons on Comedy Central before its series finale in September. The beloved series will live on in an extensive network of Wikis, subreddits, and memes, but according to physicist and math enthusiast Simon Singh in his latest book, The Simpsons and Their Mathematical Secret, the show’s most impressive legacy is its celebration of mathematics.

Longtime readers know how deep the numerical references go on *Futurama. *The highly educated writing team features no less than three former Simpsons writers with Ph.Ds – Ken Keeler, Jeff Westbrook, and Bill Odenkirk – who packed episodes with math and science content far more freely than they did on that other animated series. Two months after the show's finale, WIRED spoke to Singh and Futurama executive producer and head writer David X. Cohen about Futurama’s legacy, mathematical and otherwise.

WIRED: It seems like the writers grew increasingly comfortable integrating math and science into episode plots over the series run. Was there a conscious confidence boost from coming back from cancellations, like "our viewers will follow us anywhere at this point, so we're just going to go for it?"

Cohen: [laughs] It wasn't quite that rigid a cutoff as the point between Fox and Comedy Central. It was more a steady learning process, where when we first started writing the show [14 years ago], we were afraid to hit the science and the sci-fi too hard. We were coming out of The Simpsons, and we didn't know how far we could stray from that model of prime-time cartoons. We didn't know if people were going to be on board for the sci-fi stuff, or if they only wanted to see the characters, the purely home-based stories that they were used to. And because of the long feedback loop of animation, where you write it and it doesn't air for a year, it took a couple of years before we started realizing, "hey, the fans are really responding to the episodes where we stick to sci-fi more seriously."

So it was a few years before we really started to pay full attention to the sci-fi angle of it. And throughout the whole run to the end, I always found that a) the fans really like those episodes that are the most sci-fi heavy, and b) even more to my surprise, the comedy often seems to play better in those episodes. So we didn't really have to sacrifice anything, because when you set this huge dramatic backdrop of a science fiction story, if you take that seriously, there's a actually a very tense mood to the episode and the comedy is a real release.

WIRED: Simon's book details the many elaborate math references embedded throughout the episodes, which are often way more complex than is obvious to most viewers. How did these develop?

COHEN: We realized at first in The Simpsons, and later carrying on the tradition in Futurama, that we could hide these jokes in the background that were called freeze-frame jokes, because early on it was the beginning of the VCR era. It's ancient history now, but people finally had a way to literally freeze-frame, and use freeze-frame jokes for the first time. So we decided to fill that niche, and we would not just waste a space in the background with a generic sign that said "Supermarket open 8am to 5pm" or whatever, but we would put it, in Futurama for example, in an alien language that was a code, and a joke if you could decode it, that said "Human Meat for Sale, $5 a pound", or something like that. So we tried to cash in on every bit of real estate in space and time in the show.

The working principle was, well, we can put jokes in the background where most people will ignore it, but only a handful of people in the country, in the world, will get it, and it won't derail the other people. So if you make a lot of obscure jokes and references on a lot of different subjects in the background, then many of the viewers will have their glorious viewing moment where they'll say "oh my God, I can't believe they put in that joke for me." Once you get a viewer who has experienced that moment, you really have scored a permanent fan at that point, because nobody is catering to such a tiny group as many of these jokes that we stick in the background are.

Singh: One of the questions that people ask me is why do [the writers] put in these mathematical references. And I suggest that in a way you're reaching out to those people who are a bit like you when you were growing up. It just makes them feel more comforted and have pride in their interest in mathematics or other geeky and nerdy subjects. Is that fair?

Cohen: Yes, I think that is fair. I mean it's sort of a two-part thing. The subject matter of the math references is just stuff that many of the writers, including me, were very interested in, and it's just fun for us to put it in because we ourselves would have enjoyed seeing those references. You just have more confidence and more interest in things that are close to your heart. Of course the writers who have that background like to ram the stuff in when they could, because you don't get that opportunity on most TV shows, and writing for Futurama and The Simpsons you do, so you cash in on sneaking in something that you personally think is cool.

And part two is can we fire up interest in the new generation of viewers in these things that we like. Once in awhile I do have the thought, oh you know, if I'm spending my life making this cartoon show instead of doing some important academic research, I can still feel better about myself because if we make science and math interesting or cool in any way to a new generation of people, then I do feel a bit better about myself sometimes when we manage to do that.

WIRED: Of all the math-infused Futurama plots, like "Prisoner of Benda" and "2-D Blacktop," which are you most proud of?

Cohen: Well obviously "Prisoner of Benda" is the standout example of math actually being the star of Futurama. This is an episode where the Professor invents a machine that can switch people's brains from one body to another, but once two characters have switched brains, the machine has a defect that cannot switch their brains back. We just introduced that concept the machine can't switch back, purely as a way of making the plot more complicated. We weren't initially thinking about the mathematics of it. But then we started to run through the plot, thinking, "ok, if characters A and B switch brains, then we want to get them back, then they're going to have to start switching with other people, and try to worm their way through a number of characters to get it back into their own head.” And we started thinking, "oh my God, is this even possible. Can it be done?"

It so happened that Ken Keeler, who's come up several times now, was writing the episode already, so he jumped wholeheartedly into the subject and started thinking about the math of it, and ended up proving a theorem, which is referred to as Keeler's theorem in Simon's book. He showed that in this case, no matter how mixed up people's brains were, if you brought in two new characters who hadn't had their brains switched around yet, you could always use them to get everyone else's brain back to the original spot, including the two new people who end up with their correct brains as well. So he actually proved this mathematically, and at the climactic moment of the episode, we flashed the full mathematical proof on screen for about one second, which is about as much as people who weren't following the math could stomach. But front and center, mathematical proof behind the entire screen at the climax of the episode. You're not going to see that on most sitcoms on TV, so that's a moment of pride for Futurama.

Singh: And Ken is always mildly embarrassed when it's called Keeler's theorem, or the Futurama theorem, because he thinks it's slightly too grand a title for his work. But as you say, it's the only example of a new piece of mathematics being created in order to resolve a plot point in a sitcom.

WIRED: Are there any mathematical concepts that you meant to explore in *Futurama *but didn't get around to?

Cohen: I can think of one thing. I mentioned these alien languages that are secret codes in the background. So the first one was a very simple substitution code where each number just stands for an English letter, and the second one was a more complicated code, and we actually had a third language designed and ready to go, but we never got around to using it. The thinking was that at some point we would put in a more cryptographically secure code in the background that computers might have to improve a little bit from the time that we put it in. But the degree of difficulty there was very high in terms of how to set up the code, and would people solve it in our lifetime, a lot of complicated guesswork not really related to producing the show. It was a little too ambitious.

WIRED: There are so many Futurama memes that have taken off online. Are there any that you're particularly surprised that fans seized on?

Cohen: I'm just going to rephrase the question. The Futurama meme that really stands out in my mind is Fry in the Apple store, or the Mom store, don't tell anyone there's a close parallel there. That was the one where basically they're telling him all the defects of the iPhone, it's slow, it doesn't have that much memory, it's gonna lose it's connection, and he says "shut up and take my money."

That's the one line out of all the things that fans picked up on as memes, that at the time we were writing it, I immediately said "that is going to catch on," because it just seemed to so capture the mood of the moment. One of the real-life iPhones was just coming out at the time we were writing it, and this line is really summing up this moment in history. Now of course, it then took a year for that episode to get animated and put on the air, so a few months later I'm thinking "this line was so perfect, but the craze passed," but, what do you know, like clockwork, Apple announced their next one one year later, so once again it was perfect timing by the time it aired. So that one worked out partly by skill and partly by the good timing of Apple's release schedule.

WIRED: Futurama fans were pretty unhappy the first time the show ended, but this time around you finally got to end the show on your own terms. Two months after the series finale, is there a nagging Futurama-sized void in your life, or an actual sense of closure?

Cohen: Well, it's a little of both. But still I guess I would still stand by the feeling that it does have some completeness to it now, mainly because the first one, two, or three times we got cancelled, depending on how you add it up exactly, it always felt like we still had not quite reached the critical mass of what you could say was a successful run for a series. The first time we had 70 episodes, and then we had the DVD movies, and then we had one more season. It was always like, we never had quite 100 episodes, or whatever you had in your mind as, "we did it." Not just in terms of numbers, but in terms of the feeling of how long it's been on the air and the number of stories we've told, I feel like [this time] we really got to explore everything in great detail. Could we have gone further? Of course, it's a very big universe in Futurama. But I don't have a feeling that we were chopped off anymore.

WIRED: Do you have a sense of what's next, now that Futurama is ostensibly over?

Cohen: My immediate plan when the show ending was announced was that I was going to take the summer off, because really when Futurama or The Simpsons were in production, it was quite grueling. It's 12 months a year of work, there's no break like there is on a live-action show, because even if we finish the batch of scripts we're working on, all of the episodes are in the animation pipeline coming back every week, really, in different stages, and you have to do a little rewrite then, sometimes a big rewrite, rethink the staging, or the episode's too long. So there's not a moment's rest, really. In the case of The Simpsons, that's been going on for 26 years now. For Futurama, even starting over again after the cancellations, we did the DVD movies going straight into four years on Comedy Central. We had six years of nonstop work, basically.

So I've been at this a long time and thought I’d take the summer off. Well, it's not summer anymore ... but I'm still taking the summer off. I'm still recuperating a little bit, but I'm getting to a point now where I need to start something new. I have some general ideas, but I'm not going to share them because there's about nine of them, and any one that I share that is not the one I do, I'll be giving it away for free. But you know, there's a lot of outlets for entertainment now that didn't exist last time around, so certainly it's tempting to think about doing something much wackier and either self-produced or straight to the Internet, or I don't know. There's a lot of room for experimentation now that didn't exist before. So I have a few ideas that are more unconventional – but I don't promise to do them.

WIRED: Do you see the math legacy of *Futurama *and The Simpsons carrying over to other shows?

Singh: I think it's just a unique phenomenon. People ask me "where else does this occur?" And it just doesn't occur anywhere else. People talk about Numbers or they talk about Big Bang Theory. I think *Big Bang Theory *is great, but it's not a surprise that there's math in it. It's absolutely shocking that there's math in The Simpsons, and it's truly shocking that there's pure math, beyond the science, in Futurama. So I'm not sure that's something that will necessarily crop up again. It's only happened twice so far, and may not recur. I can't see a way for it to happen, but then we don't actually know what David is working on next.

Cohen: [laughs] If any other show tries to prove a theorem, we're going to sue them.