Chapter 2 Fundamentals of Number Theory (Unfinished)

1 Divisibility and division with remainders

1.1 Divide by

Let $a$, $b$ be positive numbers, if there is an integer $m$ such that $a=m\times b$ is true, then it becomes a non-zero number $b$ divides $a$, in other words, if $ There is no remainder when b$ divides $a$, then it is considered that $b$ divides $a$. Expressed as $b|a$, also known as: $b$ is an introduction of $a$.

(Note that small numbers can be large numbers. When represented by $|$, the decimal number is in front and the large number is behind. $m$ can be positive or negative, but it cannot be 0)

Therefore it has the following properties:

  1. If $a|1$, then $a=\pm 1$
  2. If $a|b$ and $b|a$, then $a=\pm b$
  3. If $a|b$ and $b|c$, then $a|c$, such as $2|4$, $4|8$, then $2|8$
  4. For any integer $m$, $n$, if $b|g$ and $b|h$, then $b|(m/times g+ n/times h)$, such as $3|6$, $3|9$ , then $3|(6 n+9 m)
  5. If $b|g$, then there is $g_1$, so that $g$ can be expressed as $g=b\times g_1$

1.2 Division with remainder

For any given positive integer $n$ and any non-negative integer $a$, if $a$ is divided by $n$, the integer quotient $q$ and the integer remainder $r$ are obtained, then:
$a=q \times n +r$, $0 \le r \le n $and $q=\lfloor a|n \rfloor $
where $\lfloor a|n \rfloor$ means round down, for example, $\lfloor 1.9 \ rfloor = 1$.
It is called division with remainder.

2 greatest common factor

Euclidean algorithm is one of the most basic techniques in number theory, used to find the greatest common factor of two positive integers.

Coprime: If two integers have only one common factor $1$, they are called coprime

2.1 Greatest Common Factor

The greatest common factor must be a positive number.

When $a=m\times b$, $b$ is said to be a factor of $a$.
Using $d=gcd(a,c)$, call $d$ the greatest common factor of $a$ and $b$.
Define $gcd(0,0)=0$, $gcd(a,0)=|a|$
If $c$ is the greatest common factor of $a$ and $b$, then $a$, $b$ All factors are a factor of $c$.
For example $gcd(30,24)=6$, while $2$, $3$ are both factors of $24$ and $30$, and are also factors of $6$.

Because the greatest common factor is required to be positive, it is generally $gcd(|a|,|b|)$

2.1 Euclidean Algorithm

The steps of the Euclidean algorithm are:

  1. Suppose to find the greatest common factor $d$ of $a$, $b$, and suppose $0 \le b\le a$
  2. Using division with remainder, $b$ divided by $a$ can be expressed as: $a=b q_1 \times b + r_1$,$0 \le r_1 <b$
  3. When $r_1 =0$, it can be seen that $b$ divides $a$, and there is no factor larger than $b$ in $a$. For example $gcd(18,6)$,18 \div 6 =3 $
  4. When $r_1 \neq 0 $ , then there must be $b|r_1$, because: $d|a$ and $d|b$, then there must be $d|(a-q_1 \times b)$ . So $gcd (a,b)=gcd(b,r_1 )$.

3 Modulo operation $mod$

If $a$ is said to be an integer and $n$ is a positive integer, then we define the remainder of $a \div n$ as $a$ modulo $n$. The integer $n$ is called the modulus.

$a=q\times n+ r$ ,$0 \leqr<n; q=\lfloor a \div n \rfloor$等价于 $a=\lfloor a \div n \rfloor \times n + (a   mod  n)$

3.1 Congruence property

If $(a mod n = (b mod n))$, then the integers $a$, $b$ are said to be congruent modulo $n$. It can be expressed as $a \equiv b(mod n)$, and its meaning is also: $a(mod b) = a\times (a mod b)$. It means that $a$ and $b$ modulo $n$ have the same result

  1. If $n|(ab)$, then $a \equiv b(mod n)$. So it is equivalent to: $a \equiv b \times (b mod n)$
  2. If $a\equiv b(mod n)$, then there is $b \equiv a(mod n)$ . Symmetry?
  3. If $a\equiv b(mod n)$, $b \equiv c(mod n)$, then $a \equiv c(mod n)$

3.2 Modulo operation

The operator $mod$ maps all integers to the set ${0,1,2\ldots n-1}$.
The modulo operation has the following properties:

  1. $[(a mod  n)+(b mod \n)] mod  n=(a+b) mod  n$
  2. $[(a mod  n)-(b mod \n)] mod  n=(a-b) mod  n$
  3. $[(a mod  n)\times (b mod \n)] mod  n=(a\timesb) mod  n$

That is to say, except for division, the associativity is satisfied. But note that it is not a simple associativity!

Additive inverse element: it is the opposite number
Multiplicative inverse element: multiplicative inverse element refers to any element $a$ in the group $G$ in the field of mathematics, and it has a unique inverse element $a'$ in $G$, which has the property $ a×a'=a'×a=e$, where $e$ is the identity element of the group.
Example: $4 \times X \equiv 1 mod 7$ is $4 \times X = 7\times k +1$

In addition, it has the following properties:

  1. Satisfy the commutative law of addition and multiplication: $(w+x) mod n = (x+w) mod n$, multiplication also satisfies
  2. Satisfy the associativity of addition and multiplication: $(x\times y\times z) mod \nn=(x\times (y\times x)) mod n$
  3. Satisfy the distributive law: $(x\times (y+z)) mod n = (x\times y+x\times z) mod n$
  4. Unit: Adding $0$ or multiplying $1$ does not change the result

For the remaining class, use $[m]$ to represent a set, which means that all numbers in the set (including positive and negative numbers), the result of modulo $n$ is the same.

4 prime numbers

Or prime numbers
. The core of number theory is prime numbers: when an integer $p>1$, and its factors are only $\pm 1$ and $\pm p$, the number is a prime number.
Any number can be decomposed into: $ a=p_1^{a_1}+p_2^{a_2}+p_3^{a_3}+\dots +p_m^{a_m}$. That is, the result of multiple prime numbers.
To explain divisibility from this perspective, the prime numbers it contains are the same (the number of times may be different).
To explain the greatest common factor from this perspective, it is the largest prime number that both numbers contain.

5 Fermat's theorem and Euler's function

5.1 Fermat's Theorem

If $p$ is a prime number, $a$ is an integer, and cannot be divisible by $p$ (a does not contain a prime number $p$), then:
$a^{p-1} \equiv 1( mod p)$
is Say, modulo $p$, the result is 1.
And the more general form is:
$a^{p} \equiv a(mod p)$

5.2 Euler function

Euler function: $\phi(n)$ is only the number of positive integers less than $n$ and co-prime to $n$. where $\phi(1)=1$
Therefore, if $p$ is a prime number, then $\phi(p)=p-1$: because prime numbers are co-prime to any number, and those less than $p$ have $ p-1$
and, satisfy $\phi(p_1 \times p_1) = (p_1 -1)\times (p_2 -1)$.

For any two mutually prime $p_1$ and $p_2$, there are: $p_1^{\phi(p_2)} \equiv 1( mod p_1)$, which is actually a special form of Fermat's theorem, that is, the base is also a prime number.
So it can also be expressed as: $p_1^{\phi(p_2)+1} \equiv p_1 ( mod p_2)$

6 Prime Number Test

Many cryptographic algorithms require random selection of one or more very large uncles, so a way to determine whether a given large number is prime is needed.

jump over.

7 Chinese Remainder Theorem

Problem: Find all integers $x$, when they are divisible by $3$, $5$, $7$, the remainders are $2$, $3$, $2$ respectively, then all solutions are in the form of $23+105\times k$
// Definition: Let $a=p_1 \times p_2 \times \dots \times \p_n$, where the factors $p_i$ are relatively prime

One of the uses of the Chinese remainder theorem is that it gives an operation that converts a large number operation modulo $M$ into a relatively small number.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325094221&siteId=291194637