In 1905, Britain's greatest puzzlist, Henry Ernest Dudeney, demonstrated his most famous creation at a meeting of the Royal Society in London. The Haberdasher's Puzzle is an equilateral triangle that is cut into four pieces that can be rearranged into a square. Sounds ordinary enough. Yet Dudeney's genius was that he connected the pieces together with hinges to form a chain - such that folding one way gets you a triangle and folding the other gets you the square. The "hinging" property of the Haberdasher's Puzzle, which Dudeney had made out of mahogany and bronze, has fascinated and delighted mathematicians for more than a century.

More than 100 years later, at a conference in Atlanta, Georgia, this year, Erik Demaine, 27, a professor at the Massachusetts Institute of Technology, went one better. Demaine, 6ft 2in, with a ponytail and beard, has for the past 10 years been tantalised with the problem posed by Dudeney. He wanted to know if hinge dissection could be universalised. In other words, can you dissect any straight-sided shape and then hinge the pieces together in a chain so it can be folded into any other straight-sided shape of equal area?

"I didn't believe it was true," Demaine said. But, together with his graduate students, he had discovered it was. You can transform any polygon to any other polygon of equal area through a Haberdasher's Puzzle-style hinged dissection.

Spontaneously, the hall started clapping - a rare occurrence in the higher reaches of computational geometry. "Applause for math?" he asked.

In puzzle-land, however, this was about as exciting a breakthrough as you can get - the solution to an age-old problem by one of the cleverest minds of his generation. And Demaine could not have had a more appreciative audience. He was lecturing at the world's premier gathering of recreational mathematicians. To finish his talk, he blindfolded himself and performed a magic trick. He was applauded for that, too.

To most people, the phrase "recreational maths" is an oxymoron. Maths is generally not considered fun. At school, maths is unloved, and the prejudice against it continues throughout adulthood. Whereas to hate literature is to be deemed uncultured, it is cool to hate maths and fine to throw one's hands in the air when asked to do a simple sum. Maths struggles for acceptance for several reasons. It is conceptually challenging. Calculators and computers have reduced the need for finely honed arithmetic skills. But, more than anything else, it is the legacy of tedious hours at school.

The man who has done most to make maths enjoyable for the largest number of people is a 93-year-old American called Martin Gardner. Between the 1950s and 1980s, he wrote a column in Scientific American called Mathematical Games that popularised the subject in an unprecedented way - not only in the US, but all over the world. Gardner wrote about paradoxes, puzzles, magic tricks, board games and tangential areas such as linguistics and design. His columns brought out the playfulness of mathematical ideas and expressed them in a way the layman could understand. Without him, for example, the artist MC Escher would not have achieved the fame he did and the computer game Tetris would not have been invented.

In 1993, one of Gardner's biggest fans, Atlanta businessman Tom Rodgers, decided to organise a conference in his honour. Rodgers wanted the event to bring together experts from the world of maths, magic and puzzles - three of Gardner's principal interests. He called it the Gathering For Gardner - or G4G. "So many people came, we decided to do it again in 96," Rodgers said. Since then, the G4G has happened every two years and is the most colourful event in the maths calendar. Gardner showed up for the first two events, but is now too frail to attend.

On one afternoon of this year's G4G, the delegates relocated to Rodgers' home in the Atlanta suburbs, a bungalow designed in a Japanese style, surrounded by a forest of bamboo, pine and fruit trees in blossom. In the garden, several guests were assembling wood and metal geometrical sculptures. Others shuffled around for clues in a bespoke puzzle hunt.

"Aaaaairrghhhkkk!" John Conway, maths professor at Princeton, caught everyone's attention. He wanted everyone to bring him 10 pine cones so that he could count their spirals for Fibonacci and Lucas numbers - these appear in sequences where any one number is the sum of the previous two numbers (Fibonacci starts 0,1,1,2,3,5,8,13,21... and Lucas 2,1,3,4,7,11,18...) and they are frequently found in nature. Cone-classifying is a recent preoccupation for Conway, a Liverpudlian with a Jerry Garcia beard who became famous in the 70s for his cellular automaton Game Of Life. He has counted around 5,000 pine cones in the past few years.

Inside Rodgers' house, where hundreds of items from his puzzle collection were on display, Colin Wright, an Australian who lives in the Wirral, was holding court. With his schoolboyish, ginger hair and glasses, he looks just how you might expect a mathematician to look - in fact, he is a juggler, too. "It seemed like the obvious thing to do after I learned to ride a unicycle," he said. He has helped develop a mathematical notation for juggling, which has electrified the international juggling community. It turns out that, with a language, jugglers have been able to discover tricks that had eluded them for thousands of years. "Once you have a language to talk about a problem, it aids your thought process," Wright said as he took out some bean balls to demonstrate a recently invented three-ball juggle. "Maths is not sums, calculations and formulae. It is pulling things apart to understand how things work."

I asked if there was something self-indulgent, even wasteful, about the finest minds in mathematics spending their time working on pastimes such as juggling, pine cone counting or even puzzle solving. "You need to let mathematicians do what they do," he replied, and quoted the example of Cambridge professor and number theorist GH Hardy, who in 1940 famously declared that his subject had no practical applications. Mathematicians have, in fact, been very successful in finding applications for apparently useless theorems - maths, for instance, is now the base for much internet security. "It is unreasonable that mathematicians should be so successful in this," Wright said. "You really, genuinely never know what is going to work."

It is said that doing maths averts the onset of dementia. The G4G offered some unscientific proof. Many of the guests were over 70 and some were in their 80s and even 90s - unsurprising for an event that was celebrating the life and work of a nonagenarian. One reason for Gardner's influence is that he has corresponded with thousands of readers, many of them renowned mathematicians, some of whom became close friends - among them Raymond Smullyan, 88, who is possibly the world's foremost expert in logical paradoxes. (He began his talk: "Before I begin speaking, there is something I want to say.") Smullyan seemed also to contradict the laws of ageing. With flowing white hair and beard, looking not unlike Ian McKellen in The Lord Of The Rings, Smullyan was frequently entertaining guests on the hotel piano. He also performed magic tricks on unsuspecting passersby and over dinner one evening launched into a stand-up comedy routine.

Only a few years Smullyan's junior was Ivan Moscovich, 82, a puzzle inventor who was clutching a prototype of his newest product, You And Einstein, which will be in the shops later this year. It is a type of "sliding block" puzzle in which you move blocks around a grid to make a desired pattern. Moscovich's twist is that each 3D block has a slanted mirror that reflects the box to its side, meaning that what you think is the block is actually the reflection of something else. Moscovich is excited at the thought that You And Einstein may be a global smash. "I believe this thing has a slight chance to take off, and not to sell 10,000 or 20,000, but an enormous amount."

All puzzle-makers dream of creating the next Rubik's cube - the puzzle invented by Ernö Rubik in 1974 that has sold more than 300 million. At the G4G there were talks on how to envisage a Rubik's cube in four dimensions (which drew a huge round of applause), new methods of making shapes fit together, the launch of a puzzle game called Doris, and demonstrations of how laser cutting is changing wooden mechanical puzzles. Since the simplest puzzles tend to be the best, there is a certain underlying tension in discussions of supposed advances - the idea of sophistication in puzzle design is almost a self-contradiction. The most recent puzzle craze, Sudoku, could have been invented 1,000 years ago.

Moscovich speaks with an eastern European twang and has a pencil moustache and brushed back, black hair. An Auschwitz survivor, he remembered reading Gardner's first article in Scientific American in 1956, and said it shaped the rest of his life. He comes to the G4G for inspiration. "If you could measure creativity, then the world's highest concentration of creativity in the smallest possible area is right here."

One of the rooms in Atlanta's Ritz Carlton, where the gathering was based, was given over to an exhibition of "mathematical objects" such as origami, geometrical shapes and elaborate puzzles. In one corner was Dániel Erdély, a Hungarian, next to a table on which were displayed several light blue objects about the size of a cricket ball, ridged with intricate, swirling patterns. Erdély had an intense manner, and treated his models with the affection that a dog breeder has for a set of puppies. He picked one up and held it lovingly in his hand. He pointed at the palm-sized planet's crystalline landscape and said: "Spidrons."

Erdély is not a mathematician. He is a graphic designer who studied under Rubik at the Budapest College of the Applied Arts. In 1979, as homework for Rubik, Erdély devised a new shape made out of a sequence of alternate, and shrinking, equilateral and isosceles triangles. He called the shape a "spidron" since it curved like a spiral. By the time he left university, spidrons had become his obsession. He endlessly played around with them, noticing that they could be fitted together like tiles in many aesthetically satisfying ways, in both two and three dimensions. When, about five years ago, a Hungarian friend helped write a program to generate them on the computer, the spidron became known all around the world. Its tessellating properties have captivated mathematicians, engineers and sculptors, and Erdély has reinvented himself as the shape's globetrotting chaperon. He believes it could have applications in the design, for example, of solar panels. At the G4G, he had met a man who runs a company that launches rockets. The spidron, he said, may be about to go into space.

At university level and above, maths is a very male affair, although at GCSE girls now outperform boys. At the G4G, fewer than 20% of the participants were women. Some of them presented talks in which they applied high level maths to crochet, knitting, needlework and quilting. It turns out that "mathematics and the fibre arts" can actually convey deep mathematical ideas in a novel way - such as what a hyperbolic space might look like, which is something that has baffled mathematicians for centuries. Carolyn Yackel, one of the genre's pioneers, gave a talk on how to knit a pair of hyperbolic trousers. (You knit an octagon in hyperbolic space and then join the sides together.)

Yackel, who is young, engaging and on the right side of kooky, says, "I don't think that maths is inherently male at all, although the atmosphere can be made to be. I like doing this because it mixes two things I really like, which are maths and craft. There are so many really neat ideas. Tessellations are super-duper cool."

Another type of craft that is, literally, on the cutting edge of maths research is origami. Demaine made his first major mathematical breakthrough when, at the age of 17, he and his collaborators proved that it is possible to create any straight-sided shape by folding a piece of paper and making just one cut. It might appear that such a result would be useful only to schoolchildren making complex Christmas decorations, but in fact Demaine's work has found uses in industry, especially in car air bag design.

Even though Gardner was in his 60s by the time Demaine was born, the young professor says he was influenced by Gardner's books and philosophy. "I thought [Gardner] had a playful respect for mathematics that is often lost in mathematical circles. People tend to be too serious. My aim is to make everything I do fun."

Demaine's father is a sculptor, and an aesthetic sense has been passed on to his son - some of his origami models are at New York's Museum of Modern Art. Demaine argues that mathematicians are creative artists. Art and maths are concerned with "simplicity and beauty and trying to make things elegant... they mix together in a nice way". I asked about the Haberdasher's Puzzle and the applause he received. "That was pretty cool. I was surprised. It's a problem that I care very deeply about, having worked on it for about 10 years. It was nice to get that validation."

The few dozen magicians present were giving impromptu demonstrations of close-up magic. One was "Jordini", a 21-year-old in a top hat, who is the first undergraduate in the US to be majoring in magic. "Magic was one of Martin [Gardner's] main interests," said Mark Setteducati, a magician and puzzle inventor. "There are many beautiful mathematical principles behind simple card tricks."

A charming aspect of the G4G is that all guests are asked to bring a gift - "something you would want to give to Martin". In fact, you are asked to bring 300 of them, as each guest is given a goodie bag at the end containing a gift from everyone else. This year it included puzzles, magic tricks, books, CDs, gadgets and a piece of plastic that can make a Coke can talk. One bag was for Martin Gardner, and I took it to him.

Gardner lives in Norman, Oklahoma. The day I arrived, storms were moving across the state. I took a few wrong turns off the interstate until I found his home, an assisted living centre next to a Texan fast-food joint. By his door was a box of outgoing mail. Gardner, who does not use email, is still a prolific letter writer. The king of recreational maths answered the door wearing a green shirt and slacks. He is still mentally and physically fit - he works standing up. He writes every day, has published about a book a year since the mid-50s, and continues to contribute to magazines and journals.

Gardner was widowed in 2000, and moved here four years ago to be close to his son, who works at the university in Norman. On the wall is a portrait of himself made out of dominoes - a classic genre of recreational maths art - and a large photo of Einstein, one of his heroes. The shelves are full of books and on one of his desks is an old electronic typewriter.

We began talking about magic. He described it as his principal hobby. He still practises tricks, as far as his arthritis allows. He showed me what he said is the only sleight-of-hand with cards he invented: a "wink change" where the colour of a card is changed "in a wink". He took a pack of cards and lodged a black card between the deck and the palm of his hand. Instantly, the card became a red one.

Gardner became interested in maths through "mathematical" magic tricks - and magicians, not mathematicians, formed his main social circle as a young adult. He liked magic, he said, because it gave rise to a sense of wonder about the world. "You see a woman levitated and that reminds you that it is just as miraculous that she falls to the ground by gravity... you don't realise that gravity is just as mysterious as a woman levitating."

Does maths give Gardner that same wonder? "Absolutely, yes."

I gave him the G4G goodie bag and asked how it felt to be the subject of a conference. "I am quite honoured, and surprised," Gardner said - though I got the impression he felt a little awkward about it, too. "I am not a mathematician," he said. "I am basically a journalist."

I was interviewing an elderly magician in hurricane-strewn Oklahoma. Already I had felt as if I were meeting the Wizard of Oz. And now he had pulled away the curtain. "Beyond calculus, I am lost," he continued. "That was the secret of my column's success. It took me so long to understand what I was writing about that I knew how to write in a way most readers would understand." Gardner was already middle-aged when he started writing for Scientific American, gradually getting to grips with harder concepts. Yet, even though he inspired generations of readers to take up maths, and influenced the direction of research, he still feels like an interloper.

His lack of ego endeared him to the maths community: he brought out the wonder in their subject, and was also assiduous in crediting all the academics and puzzlists who contributed ideas. His research and correspondence are considered important enough for his archive to be kept at Stanford University. While he devised some puzzles himself, essentially he assembled the work of others and presented it beautifully. Does he even like doing puzzles? "Not particularly - I'm not very good at it."

Philosophy, which he studied at university, is Gardner's first love. He began his writing career publishing science fiction stories in Esquire. And before he got on to maths, he had written Fads And Fallacies In The Name Of Science, the first popular book to debunk pseudoscience, precursor to a whole genre leading to the current atheist polemics of, say, Christopher Hitchens and Richard Dawkins. His two other passions are Lewis Carroll and - with unexpected appropriateness - L Frank Baum, creator of The Wizard Of Oz. His bestselling book is The Annotated Alice, a timeless compendium of footnotes to the two Alice books, and a decade ago he wrote a sequel to The Wizard Of Oz in which Dorothy and friends go to Manhattan. It was reviewed in serious newspapers, if not very favourably. "It is written mainly for Oz fans," Gardner says.

He shows no signs of slowing down. This year he will publish a book of essays on GK Chesterton, and among his many other projects he is compiling a bumper book of word games. As I left, I wondered if the other residents of this featureless old people's home - who were listening to a seniors' country and western band - had the slightest inkling that such an intellectual dynamo was living among them.

Gathering for Gardner puzzles, by Chris Maslanka

1 We all know that in tossing a fair coin you are just as likely to get a head followed by a head as a tail followed by a head. So what can the harm be in accepting David Singmaster's offer of a simple game? You will toss a coin repeatedly until you get a head followed by a head or a tail followed by a head. If it's a head followed by a head, he'll give you $2. If it's a tail followed by a head, you give him a dollar. Should you accept?

2 Magician and scientist Bob Friedhoffer once threw me off balance with a simple question. How many faces of a cube can you see at once? No, its faces are of an opaque material, and no, you don't have x-ray vision! Three? Hmm... you can do better than that! But you will need to think outside the box. No, no mirrors are allowed! Well?

3 Al Seckel was showing me an 8 x 8 square he had cut into 4 pieces, as shown above, but in my excitement I knocked the pieces off the table. Well, these things happen. I hastily rearranged the pieces, but got the rectangle shown. But hang on a minute! The original measured 8 x 8 = 64 square units. Whereas what I assembled had area 5 x 13 = 65. So where had the extra unit come from?

A puzzle for G4G by Wei-Hwa Huang, member of the US puzzle-solving team If one plus one is two, and twelve plus ten is twenty plus two, then what is 920197?

Solutions

1 If with the first two tosses you at once get two heads (one chance in 4), you will win $2 from David. But if you get anything else, David wins either at once: tail followed by head, or eventually: head followed by tail, or tail followed by tail, since you cannot then get a head followed by a head without having first got a tail followed by a head. So David wins three times as often as you. Don't do it!

2 Try thinking inside the box. If you squat in the corner of a big cube ( a cubical room, say), you can see at least a floor, a ceiling and three walls.

3 Note that the diagonal of the rectangle is not a straight line. In fact, the 'extra square' is a smeared out mismatch along this diagonal. The gap between the lower 'triangle' and the upper accounts for the missing square.

Wei-Hwa Huang's answer: LOVELY. This puzzle genre is known as 'verbal arithmetic'. Each letter corresponds to a different number.