The following is excerpted from Acdreamer
Theorem one: setting m and n is a positive integer of the reciprocity, then
theorem Two: When n is an odd number, there is.
Since 2n is an even number, even and even numbers must be non-reciprocal, so only consider the case of 2n and less than its odd-sum, which is exactly equal to the Euler function value of N.
Theorem Three: Set P is a prime number, A is a positive integer, then
The proof of this theorem is used in the repulsion:
Because of the number of positive integers that are less than and equal to each other, it is OK to subtract the number of non-reciprocal elements.
Then the number of smaller and non-reciprocal primes is the number of multiples of p, there is a. So the theorem has to be proven.
Theorem four: A prime power decomposition set to a positive integer n, then
This theorem can be proved according to theorem one and theorem three, in fact, the use is to tolerate. If you are familiar with the tolerance, in fact, you can directly tolerate.
Theorem Five: Set n is a positive integer, then
This can actually see the Möbius inversion to understand.
Theorem Six: Set M is a positive integer, (a,m) = 1, then: is the solution of the same equation.
Theorem VII: If n is greater than 2, then the Euler function value of n is even
Find Euler function template
Long LongEuler (Long LongN) { Long LongAns =N; for(Long Longi =2; I * I <= N; i++) { if(n% i = =0) {ans= Ans-ans/i; while(n% i = =0) n/=i; } } if(N >1) ans= Ans-ans/N; returnans;}
Using the recursive method to find the Euler function value:
Algorithm principle: The first Euler function value of I is equal to itself, if I is an even number, you can use the theorem two to find odd.
If P is a positive integer, then P is a prime number, and if the value of Euler function is equal to the case in the process of traversing, then
Indicates that the number is prime. The number of Euler functions is changed, and the number that can be divisible by the factor is also changed.
voidinit () { for(inti =1; i < MAXN; i++) Euler[i] =i; for(inti =2; i < MAXN; i + =2) Euler[i] >>=1; for(inti =3; i < MAXN; i + =2) { if(Euler[i] = =i) { for(intj = i; J < Maxn; J + =i) euler[i]= Euler[i]-euler[i]/i; } }}
Euler's function and Euler's theorem