Marcus du Sautoy, mathematician and successor to Richard Dawkins' chair at Oxford, recently presented a neat little series on BBC4 about the story of mathematics. Here's what he had to say about the sex life of the Emperors of China.

Everything in the Emperor's life was governed by the calendar, and he ran his affairs with mathematical precision. The Emperor even got his mathematical advisers to come up with a system to help him sleep his way through the vast number of women he had in his harem. Never ones to miss a trick, the mathematical advisers decided to base the harem on a mathematical idea called a geometric progression. Maths has never had such a fun purpose.

The Emperor had his Empress, three senior consorts, nine wives, twenty-seven concubines, and eighty-one slaves, a total of 121 women, and he was expected to sleep with every one of them over a period of fifteen nights. The mathematicians would soon have realised that this was a geometric progression - a sequence of numbers in which each succeeding element is a constant multiple greater than the previous one. In the case of the harem, the constant multiple was 3.

What was the rota thought up by the imperial mathematicians? Well, on the first night, the Emperor would bonk his Empress. On the second night, he would service the three senior consorts. Night 3 would find him with his nine wives. Nights 4-6 would find him wading through an assortment of his 27 concubines, nine on each night. And finally, nine nights were reserved for his eighty-one slaves, nine each night in rotation.

The object was to procure the best possible imperial succession. The rota ensured that the Emperor slept with the ladies of the highest ranks closest to the full moon, when their yin - or female essence - was strongest, and matched his yang. Fun, eh? As du Sautoy quips: