How the Euler's function is computed

Source: Internet
Author: User

The general method to evaluate the Euler's function is as follows:

1. we know that the Euler's function f (p) of a prime number P is equivalent to P (P). Then, the k power of p, that is, n = P ^ K, is easy to prove: F (N) = P ^ K-P ^ (k-1 );

 

Proof: it is known that the number of less than P ^ K has a P ^ K-1, of which the number of non-interconnectivity with P ^ K has P ^ (k-1)-1, respectively (p * 1, p * 2, P * 3, ·, p * (P ^ (k-1)-1 )). So F (n) = P ^ (k)-1-(P ^ (k-1)-1) = P ^ (k)-P ^ (k-1 ).

 

2. Assume that p and q are the numbers of the two mutex, then: F (p * q) = f (p) * F (Q );

It turns out that I kept writing a slight word here, not because it was too simple, but because I did not prove it. At first I wrote a proof, but later I found it wrong, and I never figured out how to prove it, today, I found the proof when I read the third chapter of elementary number theory at the same time, so I have to sort it out.

 

Proof: here we mainly use the simplification of the Residual Series, x1, x2 respectively through the modulo M1, M2 to simplify the residual series, then m2 * X1 + m1 * X2 simplifies the residual system by modulo m1 * M2. Because m2 * X1 + m1 * X2 uses an integer of F (m1 * m2), X1 uses an integer of F (M1), and X2 uses an integer of F (m2, therefore, F (m1 * m2) = f (M1) * F (m2 );

With the above two properties, the Euler's function is very simple. First, an integer is decomposed for a number, and then ···

The following describes a quick method:

 

Any positive integer can be uniquely expressed as follows:
K = p1 ^ A1 * P2 ^ A2 *...... * PI ^ AI; (Form of decomposition prime factor) can be introduced: E (K) = (p1-1) (p2-1 )...... (Pi-1) * (P1 ^ (a1-1) (P2 ^ (a2-1 ))...... (PI ^ (ai-1 ))
= K * (p1-1) (p2-1 )...... (Pi-1)/(P1 * P2 *...... Pi );
= K * (1-1/P1) * (1-1/P2)... (1-1/PK)
PS: using the following functions in the program, you can quickly find the value of the Euler function (A is a qualitative factor of N) if (N % A = 0 & (n/a) % A = 0), E (n) = E (n/a) *; if (N % A = 0 & (n/a) %! = 0) then there are: E (n) = E (n/a) * (A-1 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.