Unlike many of his students, Robin Wilson never had doubts about what to do with his life. "I've always wanted to be a mathematician," he says, "since I was six or seven ... When I was ill with appendicitis in the Isles of Scilly, I had two books: Lancelot Hogben's Mathematics for the Million and (Jerome K. Jerome's) Three Men in a Boat. Three Men in a Boat made me laugh too much, which wasn't good for my appendix scar, so I went back to maths. And I always wanted to be a teacher; by the age of 14 I'd decided it was going to be at a university teaching pure maths."
Everything seems to have gone pretty much to plan. After a first degree at the University of Oxford and a PhD in number theory at the University of Pennsylvania, Wilson returned briefly to Oxford before becoming a lecturer at The Open University in 1972 - only a year after the OU started delivering courses. He has remained there ever since and is now professor of pure mathematics, although he has long combined this work with a part-time teaching role at Keble College, Oxford, and an annual three-and-a-half-week total-immersion maths programme at Colorado College.
He has a further role as professor of geometry at Gresham College in the City of London, where a roster of eight professors, usually appointed for three-year terms, have been giving free public lectures for the past 400 years. Wilson recently delivered an historical survey in the persona of Henry Briggs, the first professor of geometry at Gresham. He has also been known to dress up as Leonhard Euler and Lewis Carroll.
Numerical talent seems to run in the family. Wilson's paternal grandfather, although an industrial chemist, sounds like an archetypal absent-minded professor. "He could multiply two numbers up to a thousand in his head," his grandson tells me. "Every year on my birthday I would get a letter saying: it's 1956 and you're 13, and 1956 squared is this, 1956 cubed is this, and 13 to the power of five is this ... He worked all these things out in his head. He used to drive along factorising every car number plate - until he drove into a wall!"
Wilson's father, Harold, was a brilliant student who got the best marks in an Oxford economics paper between the two wars. He could doubtless have had a glittering academic career, but he claimed, only partly in jest, that he went into politics to get away from all the back-stabbing. He was elected Prime Minister in 1964, won on three further occasions and eventually served for almost eight years.
When asked about this family connection, the younger Wilson is a bit wary. "My father came to power when I was in my last year as an undergraduate," he explains.
"I used to be very sensitive about discussing the link. It's still important to me that people get to know me first. I went to America for a year, which ended up as three years. When I came back, I got married, had a year in Cambridge, then moved to Oxford, so I was always somewhat away from it, although enjoying the positive side, too. We had Christmas at Chequers on a number of occasions. The only time I lived at Number 10 was when I came back each summer during my years in America."
A downside to being the son of the Prime Minister was being put on an IRA hit list, meaning that at one point Wilson had to check under his car and take a different route to work every day.
After seeing the heady world of power politics, doesn't maths teaching seem a bit unworldly and monastic? "That's what I like!" he replies cheerfully.
Wilson has produced his fair share of journal articles, course materials and multimedia packages, as well as an undergraduate textbook, Introduction to Graph Theory, that is still in print after 35 years. Yet he now sees himself primarily as "a communicator and a populariser" - and regrets that such essential roles are often undervalued.
"I have nothing but scorn for the research assessment exercise," he says, "which does an enormous amount of harm. The number of people who read the average pure maths research paper is in single figures. Then there's the Quality Assurance Agency for teaching. But there's a huge amount in the middle - writing textbooks, popularising the subject, giving lectures to adults and sixth-formers, refereeing, reviewing - which you don't get any Brownie points for."
It is precisely in these areas that Wilson has devoted much of his energy. He has given about 30 popular maths lectures a year since his mid-twenties, and now he gives even more. He co-authored the standard pictorial history of Gilbert and Sullivan's D'Oyly Carte years. And he has followed up his maths books for specialists and students with several aimed at a much wider audience: Four Colours Suffice: How the Map Problem Was Solved (2002), How to Solve Sudoku: A Step-by-Step Guide (2005) and now Lewis Carroll in Numberland: His Fantastical Mathematical Logical Life.
Four Colours Suffice explores a famous and seemingly simple problem - if every adjacent country has to be in a different colour, do any maps ever require more than four? - and how it was finally solved. It turns out to be "a story with many interesting and eccentric characters that include Lewis Carroll, the Bishop of London, a professor of French literature, an April Fool hoaxer, a botanist who loved heather, a mathematician with a passion for golf, a man who set his watch just once a year, a bridegroom who spent his honeymoon colouring maps and a Californian traffic cop". Some of these characters were certainly unusual. Percy John "Pussy" Heawood (nicknamed for a moustache that resembled a cat's whiskers), for example, produced a research paper on the four-colour problem - and another on the likely date of the Last Supper - in his 90th year.
As it turned out, the theorem was proved not by a splendid Victorian oddball but by Kenneth Appel and Wolfgang Haken in 1977, using a computer to grind through 1,482 different configurations by sheer brute force. Those hoping for a "clean and elegant" proof were disappointed, with Ian Stewart, professor of mathematics at the University of Warwick, commenting that "the answer appears as a kind of monstrous coincidence ... The mathematician's search for hidden structure, his pattern-binding urge, is frustrated."
Wilson seems resigned to the necessity of such computer-assisted proofs ("You can try out all sorts of things that would be far too complicated otherwise"), but his book seems to lament the passing of an age of enthusiastic amateur mathematicians.
Charles Dodgson, who adopted the pen name Lewis Carroll in 1856, was a superb populariser who pioneered the use of stories and puzzles to get across serious mathematical points. Wilson's new book brings together much of the best material and weaves in a brief account of his life and the strange world of 19th-century Oxford. How highly does he rate Dodgson as a mathematician?
"I wouldn't call him a first-rate mathematician," Wilson says, "but he did contribute in different ways to several different areas." Dodgson drew attention to a number of intriguing logical paradoxes and pioneered the analysis of voting systems. Although a pious, unworldly eccentric, he was also a don at Christ Church, Oxford, and had many friends in high places. So he sent his eloquent arguments for proportional representation straight to his fellow undergraduate, the future Prime Minister Lord Salisbury. If he had managed to convince him, Wilson speculates, the political history of Britain would have been very different.
Even more impressive was Dodgson's sheer mental agility. "I think he had a brilliant mathematical mind," says Wilson. "What impressed me most of all was his book called Pillow Problems, which he thought up while lying in bed at night. He thought them through, and the solutions, but didn't write them up until the next morning. Some are pretty difficult to do even if you've got pencil and paper, and for him to have the depth of thought to think them up - it's really quite remarkable."
In his introduction to Pillow Problems, Dodgson rather disconcertingly suggests that the book offers not just entertainment or mental exercise but a defence against the darker impulses that assail one at night: "There are sceptical thoughts, which seem for a moment to uproot the firmest faith; there are blasphemous thoughts, which dart unbidden into the most reverent souls; there are unholy thoughts, which torture, with their hateful presence, the fancy that would fain be pure. Against all these some real mental work is a most helpful ally." Similar sentiments can be found in his diaries. What on earth did he feel so guilty about?
There are now vast tracts of heated debate about Dodgson. At the lunatic fringes, some have claimed he was Jack the Ripper or have used anagrams to "prove" that he was homosexual. But the real dispute is about whether a man who could say things such as "I am fond of children (except boys) and have more child-friends than I could possibly count on my fingers, even if I were a centipede" should be seen, in one biographer's words, as "the world's favourite saint" or "the world's favourite paedophile". Some cite missing pages from Dodgson's diary and an extended rift with the Reverend Henry Liddell, the dean of Christ Church and father of the original Alice. Others appeal to the Victorian cult of childhood innocence and suggest that Dodgson has to be put in the context of his time.
Wilson is very firmly in the defence camp. He wrote Lewis Carroll in Numberland, he tells me, partly "because there's so much rubbish written about him - and in particular about his child friends. Perhaps I am naive and perhaps I went too far in the opposite direction, but certainly there's never been any evidence of anything inappropriate. His strong feelings for children were a result of his family background, as one of 11 kids where he was the oldest boy and took on the role of entertaining the younger ones. I think it all arose out of that."
But weren't Dodgson's photographs of naked young girls a bit strange? Even if he wasn't a "filthy pervert", surely there is something that needs explaining?
Not at all, says Wilson. "How many photographs did he take? Three thousand. He took a lot of photos of boys as well as girls, a lot of photos of adults - but about 1,500 were of children. How many were of nude children? Ten, fifteen. He was probably the most important children's photographer of his age because he was one of the first to use photography as an art, had a lot of fun watching the children getting dressed up in their costumes - and of course they're a lot more natural than adults and were able to sit still for the time he needed." Whenever people try to sully Carroll's reputation, Wilson adds, "I've always sided with him."
We may never unravel the mysteries of Dodgson's private life, but perhaps it doesn't matter. His mathematical writings may not work as a cure for lustful or impious thoughts, but Wilson has shaped them into something far better: a delightful blend of whimsy, satire, endlessly ingenious puns, brain-teasers and unexpected (but very accessible) mathematical insights.