The following correction was printed in the Guardian's Corrections and clarifications column, Thursday April 19 2007





After lying almost untouched in the vaults of an Italian university for 500 years, a book on the magic arts written by Leonardo da Vinci's best friend and teacher has been translated into English for the first time.

The world's oldest magic text, De viribus quantitatis (On The Powers Of Numbers) was penned by Luca Pacioli, a Franciscan monk who shared lodgings with Da Vinci and is believed to have helped the artist with The Last Supper.

It was written in Italian by Pacioli between 1496 and 1508 and contains the first ever reference to card tricks as well as guidance on how to juggle, eat fire and make coins dance. It is also the first work to note that Da Vinci was left-handed.

Although the book has been described as the "foundation of modern magic and numerical puzzles", it was never published and has languished in the archives of the University of Bologna, seen only by a small number of scholars since the Middle Ages.

The transcription has taken eight years, involved several translators and cost thousands of pounds. William Kalush, a magician and the founder of the Conjuring Arts Research Centre in New York, who financed the project, said: "This book is the first major manual that is primarily concerned with teaching how to perform magic."

"Sources of magic methods go back at least to the first century, but this book teaches not only the methods but also gives a glimpse into how one might perform them with an eye to entertaining an audience."

The book was rediscovered after David Singmaster, a mathematician, came across a reference to it in a 19th-century manuscript.

"It's the foundation not only of modern magic but of numerical puzzles too," he said. "We don't know why, but this huge thing has been hidden away in the University of Bologna we presume since the time of Pacioli."

Experts believe it will give a greater understanding of magical history as well as insights into Da Vinci's life and work. Carlo Pedretti, a leading art historian, studied the original Italian text in Bologna in 1954. He said: "It's a very important document. It shows how much Da Vinci liked games and tricks - but only if they had scientific foundations. It's also a very important document from the viewpoint of his work as it mentions The Last Supper."

The manuscript contains a previously unknown anecdote about Da Vinci.

Dr Pedretti said: "Leonardo was working as an architect and general engineer for Cesare Borgia - the illegitimate son of Pope Alexander VI - who wanted to establish a new state in Italy in 1502. On their journey they came across a river and Da Vinci very quickly figured a way to use tree trunks to build a bridge - this is the first time we hear this story."

Pacioli was born in Tuscany in 1445 and was a travelling mathematics tutor. He is often called the father of modern accountancy because his book The Summa (1494) contains the first published description of double-entry bookkeeping, accountancy's basic technique.

He lived with Da Vinci in Milan from 1496 for several years and taught maths and geometry to the painter, scientist and inventor. They collaborated on many projects including a book, De Divina Proportione (1509), which Da Vinci also illustrated.

De viribus quantitatis is divided into three sections: mathematical problems, puzzles and tricks, and a collection of proverbs and verses.

Tricks include how to write a sentence on the petals of a rose, wash your hands in molten lead and make an egg walk across a table ("commoners will consider it a miracle".) It also contains some of the first known European examples of numerical puzzles, which are similar to those printed in today's newspapers, such as Sudoku.

There is also a diagram of a moving piece puzzle - such as those found in Christmas crackers - which was the medieval version of the Rubik's cube.

Elsewhere in its pages, Pacioli explains a technique for writing in code, which may have been inspired by Da Vinci, whose left-handedness meant he sometimes wrote backwards making the words decipherable only with the use of a mirror.

No originality attaches to this work and Pacioli himself called it a compendium. Some of the problems are found in the notebooks of Da Vinci and although he never mentions Pacioli directly, experts believe that De viribus quantitatis shows their relationship was mutually beneficial.

Lori Pieper, the manuscript's main translator, said: "There's one particular case when Pacioli describes a mariner's clock or compass."

"He writes, 'Well Leonardo, you can do more of this on your own.' It implies that Pacioli also gave inventions to Leonardo and it wasn't just a one-way street. They learned from each other."

Although Da Vinci was a polymath interested in everything from art to anatomy, and Pacioli was a man obsessed by figures and logic, some believe both were enchanted by the magic of numbers.

"Maths and magic are intertwined," said Eddie Dawes, the Magic Circle's historian. "There are a number of magic tricks done with maths which date back a long time - like prediction tricks. The means by which magic is produced has obviously changed since Pacioli's day but the basic effects remain much the same."

De viribus quantitatis was written at a time when people were burnt at the stake for witchcraft and in the manuscript Pacioli seems to want to demystify trickery and to prove it was more about sleight of hand than supernatural powers.

Mr Singmaster said: "Perhaps he wanted to help rid us of our superstitions and make the world more rational and understandable."

The translation of De viribus quantitatis will be published next year to coincide with its 500th anniversary. Until then, Da Vinci aficionados and aspiring magicians will have to be content with visiting the Conjuring Arts Research Centre where a copy will be kept.

Tricks of the trade

For washing your hands in melted lead

Take cool well water and soak your hands for a while; then shake them, you can put them in a pan full of melted lead over a flame, and it will not cook you. It is even better if you put some ground rock alum in the water ... to the uneducated ... it will appear to be a miracle.

Make a coin go up and down in a glass

Take some magnetic powder and rub it on a quattrino [copper coin] before putting the coin in some vinegar. Then take a little bit of the magnetic powder between your thumb [and index finger] and tap the glass of water, where the coin is, and it will come up and go down ... with your hand.

Card tricks

You will be able to teach the said boy, since he is closed [in a room] or at a distance, to guess which card some people have touched without seeing it, by way of the numbers you have agreed on with him: that is, by placing a number on the figures and cards according to the trick, and according to the agreement made between you ... since it always appears to those who do not know the way ... that all [these] things are done by the magic art of divination. And thus with spots on dice, and the ring, so you will always be able to do stupendous things with him ... but you must do it cautiously, so that you might not be embarrassed, since the more secret things are, the more beautiful they are.

How to make an egg walk

[Take] an egg that has been emptied through a hole made with a pin, and then filled in with white wax, so the hole cannot be seen. And get a hair from a braid, the longest you can, and attach it to the shell with ... solid wax. Fasten another bit of wax to the other end ... placing the egg on the table, with the nail of your middle finger, pick up the said wax, and by moving it here and there ... it will follow. This must be [done] in a place not too brightly lit, with onlookers at a distance.