It's August in an even-numbered year. That means only one thing: time to head up the road to Birmingham airport. Not to fly, though. To attend the Discworld convention at one of the airport hotels.

You may be wondering why a serious and respectable mathematician is planning to spend four days in the company of 800 committed sci-fi fans, who, when not clad in anoraks, are dressed as wizards, witches, trolls and vampires, attending debates such as "Elves: nasty or nice?" and "The great hedgehog race". The answer is that I enjoy spending time in the company of the highly intelligent devotees of Sir Terry Pratchett's brand of humorous fantasy. Which isn't exactly science fiction (or SF or s-f; only mundanes call it "sci-fi" and if you need to know what a mundane is, then you are one already). The fancy dress is a bit of fun, not a lifestyle; if anyone's wearing an anorak it's likely to be me; and I follow the party line on elves. Two years ago the hedgehog race was absolutely gripping, and I'm hoping it will be even better this year ...

I do sometimes stop and ask myself: How did I get into this? Well, 13.4 billion years ago when the big bang was no more than a gleam in God's eye ... No, perhaps that will overrun my word length.

It's all Jack Cohen's fault, basically.

Jack and I share a love of science fiction, and in 1990 he dragged me along to Novacon, the annual Brum group con – sorry, convention of the Birmingham Science Fiction group. And this chap Terry Pratchett was there: not as a speaker, although by then he was already very famous, but revisiting his roots as a fan. Jack knew Terry – Jack knows everybody – and we were introduced, and had lunch. One thing led to another, and within a mere eight years the three of us were working together on The Science of Discworld.

Terry is one of the most intelligent people I know, and his humorous fantasy has attracted a vast number of devoted readers. His books have hidden depths: Small Gods is an insightful critique of organised religion, Equal Rites shows just how hard it is to be a woman in a man's world, and his recent Unseen Academicals is not solely about football. Most of his books, though by no means all, are set on Discworld, a sensible flat world held up by four giant elephants standing on the back of a spacefaring turtle. On Discworld, things happen because people want them to, or because the power of story makes them inevitable. So much more reasonable than our own ridiculous Roundworld, which is the wrong shape for starters: were it not for a transparent fudge called "gravity", people on the underside would fall off.

Every two years, those of us who like that sort of thing have the chance to get together, meet Terry, and discuss the true nature of elves, the laws of pachydermodynamics, and the role of credit default swaps in the collapse of the world economy, over a pint of Spitfire or a glass of merlot. These days, a lot of families come with their children, and it's often the children who are the biggest fans. These days, a lot more people know about Discworld because they've seen it on the telly. But even before Sky broke down the media barriers, Discworld was a publishing phenomenon.

Terry's books tread the boundary where science fiction merges into fantasy. Only Terry would ask what the tooth fairy wants all those teeth for. His writing is informed by everything from Welsh folklore to superstrings. As a result, his fans are by no means the anorak-wearing loonies that the popular press seems to imagine. More than half are women, their ages range from five to 100, and the strange person dressed up as death's apprentice often turns out to be an accountant, a doctor, or the CEO of a small electronics company.

Mind you, I did meet a genuine witch when DWcon was in Hinkley.

What the fans share, and I have come to relish, is Terry's deep sense of comedy, tinged with an element of seriousness. They come to have fun, but they don't just binge in the bar. Instead, they have a friendly drink or two while discussing how likely it is that the Large Hadron Collider will find the Higgs boson, or why little pigs and billy-goats gruff always come in threes.

This year, I'm talking about "The deterministic monkey theorem", which perhaps doesn't sound quite as serious and respectable as, say, a PhD course on Nonlinear Dynamics. Though, to be honest, most of it comes from a PhD course on Nonlinear Dynamics. But – well, let's say that for this audience, the presentation has to be a tiny bit different.

 Ian Stewart is the author of Professor Stewart's Cabinet of Mathematical Curiosities, out now in paperback