# Modular arithmetic: you may not know it but you use it every day

## That’s Maths: Modular arithmetic is used to calculate checksums for ISBNs and Ibans

You may never have heard of modular arithmetic, but you use it every day without the slightest difficulty. In this system, numbers wrap around when they reach a certain size called the modulus; it is the arithmetic of remainders. When reckoning hours, we count up to 12 and start again from one. Thus, four hours after 9 o’clock it is 1 o’clock. Numbers that differ by a multiple of the modulus 12 are said to be congruent modulo 12.

A similar situation arises for the days of the week, which are computed modulo seven. Suppose today is Thursday. What weekday will it be 1,000 days from today? We don’t have to count through the thousand days, just calculate the remainder when 1,000 is divided by seven, which is six. Then the weekday 1,000 days from today will be the same as in six days, a Wednesday.

It is much the same for other time measurements. With 52 weeks in a year, the week number is reset to 1 at the beginning of each year, so it is confined to the range 1 to 52. Likewise, for the months, we use modulo 12 arithmetic.

#### The prince

Modular arithmetic was introduced by Carl Friedrich Gauss on the very first page of his magnum opus Arithmetical Investigations, or Disquisitiones Arithmeticae. Gauss was one of the most brilliant mathematicians of all time. His genius became evident at an early age. His primary school teacher set a task for the class: hoping for some peace, he asked his pupils to add up the first 100 numbers. While his classmates attacked the problem head on, Gauss, who was just eight, spotted a pattern that led directly to the answer. He paired 1 with 100, 2 with 99 and so on to 50 with 51. Since each of the 50 pairs added to 101, the grand total must be 5,050. Gauss gave this correct answer within a minute or so, thwarting the teacher's plan.