I was ill and delayed for two days. We will continue to work with our teammates tomorrow...
To sum up, I have previously learned the number theory knowledge.
Today, a small search of computer number theory is really a huge field. We recommend a book "number theory". Ready to buy,
Here we will first discuss Euler's theorem and Euler's function.
A long time ago I thought they both mean ()
Euler's function:
Definition: Used to calculate P (n), the number of all ing qualities smaller than N.
Calculation Formula: P (n) = N * (1-1/P1) * (1-1/P2 ).... * (1-1/PK) [P1, P2, PK are all prime factors of N]
In addition, if n = p1 ^ Q1 * P2 ^ Q2 *... * PK ^ qk
Then, P (n) = (p1-1) * P1 ^ (q1-1) * (p1-1) * P2 ^ (q2-1 )...... * (pk-1) * PK ^ (qk-1)
Properties: If M, N are mutually qualitative, Phi (Mn) = PHI (m) PHI (n ). When N is an odd number, Phi (2n) = PHI (N)
Programming implementation:
// Calculate the number of mutual quality with N # include <iostream> # include <math. h> # include <stdio. h> using namespace STD; int main () {int n, m; while (CIN> N) {int I; M = N; for (I = 2; I <= (INT) SQRT (double (n) + 0.5); I ++) {If (N % I = 0) m-= m/I; while (N % I = 0) N/= I; // find the common factor if (n = 1) break;} If (n> 1) m-= M/N; // cout deduplication <m <Endl ;}}
Euler's theorem:
A, M ing, a ^ PHI (m) 1_1 (mod m)
For example, 2 ^ 2% 3 = 1
Inference: For the numbers a and N of the mass, a ^ (PHI (n) + 1) ≡ A (mod N) is satisfied)
Ferma's theorem:
If P is a prime number and (A, P) = 1, then a ^ (p-1) 1_1 (mod p) If P is a prime number, and a and P are mutually qualitative, then the remainder of A's (p-1) power divided by P is invariably equal to 1
Ferma's theorem:
When the integer N is greater than 2, the indefinite equation x ^ N + y ^ n = Z ^ n about X, Y, and Z has no positive integer solution.
Wilson's theorem:
If only p is a prime number:(P-1 )! Mod p)