# Modulo calculator

In arithmetic, cryptography and number theory, such a mathematical operation as division with a remainder is widely used. It is applied to whole and natural numbers, which can act as a dividend and divisor. When the first is divided by the second, an integer and a remainder less than the divisible are formed. For example, dividing 17 by 3 results in the integer 5 and the remainder is 2. The general formula is: a = b ⋅ q + r, where a and b are integers and b is not equal to zero. The remainder of division r must not be a negative number, and is always less than b (the divisor).

The most common and easiest way to divide with a remainder is in a column, which is studied in elementary school. The calculation can also be carried out by selecting an incomplete quotient and through sequential subtraction. These methods apply to integers and natural numbers. In higher mathematics, methods of division without a remainder of polynomials, real numbers and Gaussian integers are also considered.

## History of occurrence

Division with a remainder is also called Euclidean division, but archaeological research suggests that the ancient Greek mathematician Euclid was not the first to formulate the rules for this mathematical operation. So, it was used long before his life - more than 2000 years BC, in ancient Egypt.

The Egyptians already knew the signs of divisibility by numbers from 2 to 10, and in the 3rd century BC this topic was developed by the Alexandrian scientist Eratosthenes of Cyrene. He compiled a list of prime numbers from 1 to 100, in which all composite numbers were crossed out by elimination. The remaining, not crossed out numbers (from 2 to 97 with intervals) are simple - this sequence, which was called the sieve of Eratosthenes, can be continued indefinitely: from 100 or more, for all subsequent integers.

At about the same time, in the 3rd century BC, the mathematician Euclid of Alexandria was using (but not inventing) a new calculation algorithm. The fact that this is not his invention can be stated with full confidence, since the algorithm was described in Aristotle's "Topic" back in the 6th century BC. Nevertheless, it was Euclid who gave an exhaustive description of division without a remainder, presenting it as "finding the common measure of two segments." This method is mentioned in the VII book of "Beginnings" (for finding the greatest common divisor of two natural numbers), and in the X book of "Beginnings" (for finding the greatest common measure of two homogeneous quantities).

According to the Euclidean algorithm, when one integer is divided by another, a new pair of numbers is formed, consisting of a smaller number and the difference between it and a larger number. When the operation is repeated many times, the numbers are equated to each other, and the resulting value is the greatest common divisor for the given number pair.

In Ancient Greece and Ancient Rome, the Euclid method was applied only to lengths, areas and volumes. It has been used for a long time in engineering calculations, in construction, shipbuilding and many other sciences / crafts. Research continued into the 13th century, when the Italian mathematician Leonardo of Pisa (better known by his nickname Fibonacci) developed divisibility criteria for integers. For example, he found that when dividing each number by the next one (17 by 18, 45 by 46), the number 0.382 is obtained through one value; and in the reverse operation - 2.618.

In those days - without computing devices and a theoretical basis - such complex calculations were available only to outstanding mathematicians, and further contributions to the topic of division without a trace were made only in the 17th century: Joseph Raphson, Isaac Newton ) and Blaise Pascal.

Newton and Raphson developed a new number-independent way of dividing, and Pascal developed an algorithm by which every integer can be divided by another integer. By the way, it was Pascal who in the 17th century invented and actively used the adding machine in calculations - the prototype of the adding machine, invented in 1873.

As for the name "Euclidean division", it appeared only in the 19th century - as an abbreviation for "division of Euclidean rings". If in ancient times the Euclid method was used only for lengths, areas and volumes, then European studies of the 17th-19th centuries made it possible to apply it to polynomials (from one variable) and Gaussian integers. And in the 20th century, this algorithm was extended to other areas of mathematics, in particular, to knots and multidimensional polynomials.

And although division without a remainder was known to ancient civilizations long before the life of Euclid, it is with his name (and with his method) that this common mathematical operation is associated today, which has become especially useful in the era of global digitalization and computerization.