The other is Carl Friedrich Gauss, an astronomer and mathematician, who cannot live without women, but who leaps out of bed on his wedding night to note a formula. From his home in Göttingen, Gauss discovers that space is bent.

The two men - old, famous and a bit odd - meet each other in Berlin in 1828. No sooner has Gauss emerged from his carriage, however, than he finds himself caught up in the confusion of Germany after the fall of Napoleon.

Gripped? You will be. In fact, Measuring the World has proved nothing less than a literary sensation. Since it was published last September, the novel has sold more than 600,000 copies in Germany, knocking JK Rowling and Dan Brown off the top of the best-seller list.

Last week it was still at number two, 10 months after publication.

The book, which also features a senile Immanuel Kant, is the most successful German novel since Patrick Susskind's Perfume two decades ago.

It hasn't just delighted the readers. It has also enthralled Germany's famously grudging critics, who have swooningly praised the novel and hailed its author - 31-year-old Daniel Kehlmann - as a literary wunderkind.

Nabokov comparisons

Already, he is being compared to Nabokov and Proust. "Normally when you send a novel to a publisher you do it with a sense of nervousness. But I sent this one off with a feeling of joy," Kehlmann told the Guardian.

"I had hoped it might sell 40,000 or 50,000 copies. I never dreamed of this success."

The novel marks a change in Germany's post-war literary landscape. For decades German fiction has enjoyed the reputation of being serious, worthy and a bit dull. It has, for the most part, been preoccupied with the country's grim past.

Recently however, several young authors including Kehlmann himself, Jakob Hein, and the Russian-born Wladimir Kaminer, have demonstrated that they can write with playfulness and irony.

And although its subject could hardly be more German, Measuring the World does not feel like a "German" novel - more like the kind of thing that Gabriel García Márquez might have written had he been born in Stuttgart.

"I wanted to write a Latin American novel. But I'm not from Latin America. I can't write like Márquez, who has a beautiful woman putting the washing on the line and suddenly being caught up by the wind and flying away," says Kehlmann, who lives in Vienna but is currently staying in Strasbourg.

"But I could have the Latin American atmosphere and playfulness and absurdity and anything could happen.

"I've written a Latin American novel about Germans and German classicism."

What distinguishes Measuring the World from previous German novels is its delightful authorial irony, whether describing the failed seduction of Humboldt by a 15-year-old servant girl - the book suggests that Humboldt is probably gay - or his adventures up the Orinoco river. At one point an alien spaceship makes an appearance, leaving the reader wondering whether anything in the story is actually true.

"It has the tone of a non-fiction book. But it keeps slipping into fiction and mock-historical monography," Kehlmann said.

"It's very sincere, but not sincere at all."

Kehlmann is also shaking up the German publishing industry with attacks on the "morose special path" that German writing has trodden in the post-war years.

Earlier this month he bemoaned the fact that German writers are forced to give hour-long public readings, and instead of writing novels, spend most of their lives on trains.

In particular he has let rip at Group 47, a group of leftwing writers and critics including Günter Grass who, he said, had ensured that German writing remained provincial, elitist and aloof. They had also failed to recognise the greatness of WG Sebald, he said.

Brandenburg's Humboldt Society, meanwhile, has complained that Kehlmann has shown insufficient reverence to Humboldt, one of Germany's greatest scientists.

But most critics have got the point: that after a long period of estrangement new German writers have discovered humour.

"A lot of German literature has the same reputation as Germany does abroad," Felicitas von Lowenberg, literary editor of the Frankfurter Allgemeine Zeitung said.

"It's serious. And it's all about history. You feel weighed down by it."

"And then Kehlmann comes along. He's amazing. He's very serious yet at the same time makes it all look so easy and playful. It's very hard to be witty and funny at the same time without being shallow. He's charming as well."

Magic realism

Increasingly, it seems, young German writers are no longer looking to Thomas Mann and Grass for inspiration, or studying the theories of Theodor Adorno.

Instead, they are looking to Anglo-Saxon fiction and Spanish magic realism. Kehlmann - who studied German literature and philosophy at university, publishing his first novel at 22 - spent his teens reading Nabokov and Borges. He likes British writers including Zadie Smith and Ian McEwan.

"Atonement is one of the best novels of the past 30 years. An incredible masterpiece," he says.

More than this, though, Kehlmann says that Germans are beginning to get over the belief - carefully fostered by the feuilleton or arts sections of the big newspapers - that only high culture counts.

"I'm a big fan of The Simpsons," he explains. "I think it's great modern art. A lot of interesting epic art now comes from US TV. You have The Sopranos. It's a modern realist novel that isn't expressed as a novel. It's like modern Balzac."

"Germany has yet to catch up,' he says. "If you look the same thing happened with the 18th-century novel. In the 18th century if you wanted to be highly regarded you had to write verse epics.

"Novels were low-rate entertainment. The novel became an art form and nobody wrote verse epics any more."

A British edition of Measuring the World will be published by Quercus in spring 2007.