Definition of prime number: A natural number with only two positive factors (1 and itself) is a prime number. Numbers greater than 1 but not prime are called composite numbers . 1 and 0 are neither prime nor composite. Prime numbers play an important role in number theory .

For example, there are 20 prime numbers from 1 to 72: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71.

**The multiplicative inverse element** refers to any element a in the group G in the field of mathematics, which has a unique inverse element a' in G, and has the property a×a'=a'×a=e, where e is the identity element of the group .

**Definition: If ab≡1(mod m), then b is said to be the modulo m inverse of a, and denoted as the modulo m inverse of a is the solution of the equation ax≡1(mod m).**

For example: what is the multiplicative inverse of 4 with respect to 1 modulo 7?

4X≡1 mod 7 This equation is equivalent to finding an X and K, satisfying 4X=7K+1, where X and K are both integers.

If ax≡1 mod f, then the multiplicative inverse of a with respect to 1 mod f is called x. It can also be expressed as ax≡1(mod f).

When a and f are relatively prime, a has a solution to the multiplicative inverse modulo f (and this solution is less than f). If they are not mutually prime, there is no solution. If f is a prime number, any number from 1 to f-1 is relatively prime to f, that is, there is exactly one multiplicative inverse element modulo f between 1 and f-1.

The above is also called the existence theorem of inverse elements.For example, to find the multiplicative inverse of 5 modulo 14:

14=5*2+4

5=4*1+1

It shows that 5 and 14 are mutually prime, and there is a multiplicative inverse of 5 with respect to 14.

1=5-4=5-(14-5*2)=5*3-14

Therefore, the multiplicative inverse of 5 modulo 14 is 3.

If you still don't understand, let's look at a few more examples~

<eg1> Find the modulo 7 inverse of 5.

Do the rolling and dividing method to obtain the integers b and k, so that 5b+7k=1, then b is the modulo 7 inverse of 5.

The calculation process is as follows: 7 = 5+2

5 = 2*2+1

Back generation 1 = 5-2*2 = 5-2*(7-5) = 3+5-2*7

5^-1 ≡ 3 (mod 7).

<eg2> Find the modulo 26 inverse of 7.

method one:

It is possible to traverse the numbers from 1 to 26 that are mutually prime to 26 (3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25), and the number of points that can be multiplied by 7 mod 26 = 1 is its Inverse, it is easy to find 7*15=105, 26*4=104, so the inverse element is 15.

Method Two:

Let 7a = 1+26k, it is easy to get a set of solutions: a=15, k=4, so 7^-1 ≡ 15 (mod 26).