A positive integer is a prime if and only if:
Let and s.t. , then:
Let be a prime and , then:
or equivalently:
Would you like to be an author?
Since we can add, subtract, multiply, divide even... what would be missing? Powering! I'm not talking about some power fantasy here, but rather introduce some really really important theorems. Fermat little's theorem proves useful in a great deal of situation, and is along with Euler's theorem a piece of arithmetic you need to know. Arguably the most canonical example of using these is the RSA cryptosystem, whose decryption step is built around Euler's theorem.
Since we want to talk about powers, let's look at powers. And because I like 7, I made a table of all the powers of all the integers modulo 7.
Power
0
1
2
3
4
5
6
1
0
1
2
3
4
5
6
2
0
1
4
2
2
4
1
3
0
1
1
6
1
6
6
4
0
1
2
4
4
2
1
5
0
1
4
5
2
3
6
6
0
1
1
1
1
1
1
On the last row, there is a clear pattern emerging, what's going on??? Hm, let's try again modulo 5 this time.
Power
0
1
2
3
4
1
0
1
2
3
4
2
0
1
4
4
1
3
0
1
3
2
4
4
0
1
1
1
1
Huh, again?! Clearly, there is something going on... Sage confirms this!
Claim (Fermat's Little Theorem): Leta prime.
When, this is equivalent to what we observed:. There are several proofs of Fermat's Little Theorem, but perhaps the fastest is to see it as a consequence of the Euler's Theorem which generalizes it. Still, let's look a bit at some applications of this before moving on.
A first funny thing is the following:. When, this means we have found a non-trivial integer that when multiplied toyields 1. That is, we have found the inverse of, wow. Since the inverse is unique modulo, we can always invert non-zero integers by doing this. From a human point of view, this is really easier than using the extended euclidean algorithm.
Authors: A~Z, perhaps someone else but not yet (or they've decided to remain hidden like a ninja)
Thinking not over the integers as a whole but modulo some integerinstead can prove quite useful in a number of situation. This chapter attempts to introduce to you the basic concepts of working in such a context.
For the following chapter, we will assumeis a natural integer, andandare two integers. We say thatandare congruent modulowhen, or equivalently when there is an integersuch that. We denote this byor . I will use the first notation throughout this chapter.
Remark: When, we have, whereis the remainder in the euclidean division ofby
This relation has a number of useful properties:
The proofs are left as an exercise to the reader :p (Hint: go back to the definition)
Seeing as addition and multiplication are well defined, the integers moduloform a ring, which we note. In sage, you can construct such ring with either of the following
Powering modulois relatively fast, thanks to the algorithm, so we needn't worry about it taking too much time when working with high powers
As a side note, remember that if an equality holds over the integers, then it holds modulo any natural integer. This can be used to prove that a relation is never true by finding a suitable modulus, or to derive conditions on the potential solutions of the equation.
Example: by choosing an appropriate modulus, show that not even god is able to find integersandsuch that
Since we can multiply, a question arises: can we divide? The answer is yes, under certain conditions. Dividing by an integeris the same as multiplying by its inverse; that is we want to find another integersuch that. Since, it is clear from that such an inverse exists if and only if. Therefore, the units moduloare the integers coprime to, lying in a set we call the unit group modulo:
Finding the modular inverse of a number is an easy task, thanks to the (that outputs solutions inandto the equationfrom above).
Todo