Adición modular is a mathematical operation that involves adding two integers and then taking the remainder when divided by a third integer known as the modulus. This operation is commonly used in various fields, including ciencias de la computación, cryptography, and number theory.
Matemáticamente, la adición modular puede expresarse como:
a + b (mod m)
Aquí, a and b are the integers being added, and m is the modulus. The result of the operation is the remainder of the sum a + b when divided by m.
Por ejemplo, si queremos realizar una adición modular con a = 7, b = 5, and m = 6, we first add the two numbers:
7 + 5 = 12
A continuación, encontramos el resto cuando 12 se divide por 6:
12 mod 6 = 0
Por lo tanto, 7 + 5 (mód 6) = 0.
La adición modular tiene varias propiedades importantes, incluyendo:
- Cerradura: The sum of any two integers under a given modulus will always yield another integer within the same modulus.
- Propiedad asociativa: El orden en el que se realizan las sumas no afecta el resultado.
- Propiedad conmutativa: La suma permanece igual independientemente del orden de los operandos.
Estas propiedades hacen que la suma modular sea particularmente útil en algorithms where a fixed range of values is needed, such as in cyclic tasks, scheduling, and even in creating hash functions.