Division and Greatest common divisor
Author: Zademn
Last updated
Was this helpful?
Author: Zademn
Last updated
Was this helpful?
Two of the skills a cryptographer must master are:
Knowing his way and being comfortable to work with numbers.
Understanding and manipulating abstract objects.
This chapter of fundamentals proposes to prepare you for understanding the basics of number theory and abstract algebra .We will start with the most basic concepts such as division and build up knowledge until you, future cryptographer, are able to follow and understand the proofs and intricacies of the cryptosystems that make our everyday life secure.
We will provide examples and snippets of code and be sure to play with them. If math is not your strongest suit, we highly suggest to pause and ponder for each concept and take it slow.
For the math-savy people we cover advanced topics in specific chapters on the subjects of number theory and group theory.
So what are we waiting for? Let's jump right in!
Let be the set denoting the integers.
Definition - Divisibility
For we say that divides if there is some such that
Notation:
Example
For we have because we can find such that .
Properties
Definition - Division with remainder
Examples:
Exercises:
Now it's your turn! Play with the proprieties of the division in Python and see if they hold.
Definition
Examples:
Remark:
and implies
Example: Let and
and . We can find such that
and implies
if and then
Let with ,
There exists unique such that and
is called the quotient and the remainder
To find python offers us the divmod()
function that takes as arguments
If we want to find only the quotient we can use the //
operator
If we want to find the remainder we can use the modulo %
operator
Let be 2 integers. The greatest common divisor is the largest integer such that and
Notation:
for all other common divisors of we have
What can we say about numbers with ? How are their divisors?