Leonardo was fascinated by certain geometrical problems that dated back to classical antiquity and was convinced that geometry held the key to interpreting nature. During his time in Milan, he became friends with the celebrated mathematician Luca Pacioli who introduced to the mathematical studies of Euclid and Archimedes. The friendship between them became so strong that Leonardo drew with his "ineffable left hand"  as Pacioli said  "the five geometric bodies" that illustrated the now lost edition of Pacioli's De Divina Proportione. Leonardo's encounter with mathematics was not in itself a novelty, mathematics being the basis of perspective, the painter's science, whose rules were taught in Renaissance studios.
The novelty lay in his extremely intense study over a period of about eight years during which, according to the sources, he almost completely lost interest in practical matters. He attempted many solutions to the problem of squaring the circle which consisted of using only a ruler and pair of compasses to find the square with the same area as a given circle. He designed an instrument for solving the optical problem of the Arabian Alhazen, that of finding the route that a ray of light which has been reflected on a spherical surface must travel from the point of light to the eye. He used a solid with 256 faces, called a mazzocchio, to test himself when making perspective drawings of very complex solid forms. In his Milan period, he began to work on division using a very complicated method that was in use in the fifteenth century.
In this method, the dividend and the divisor are placed on two lines, one above the other, and the result is written on the right, on the other side of a vertical line. The calculation is carried out with a rhombus shape where the remainders are written above and the divisor is repeatedly written below. Some of these arithmetical calculations appear in the Codex Atlanticus but, strange to say, not all of them are correct. Another curiosity is that in 1967, scholars found a drawing in the Madrid Codex which can be interpreted as a calculator very similar to the one designed by Pascal and regarded as the first calculator. Other scholars, however, maintain that it is not a calculator but a machine for transmitting rotatory motion with fixed ratios. The machine, however, has thirteen contact wheels and would have produced so much friction that it would have been incapable of transmitting motion.
