Prime Number in number theory learning

Source: Internet
Author: User

Prime Number in number theory learning

1. Definitions:

Division: Set A and B to two integers, and B! = 0 if there is an integer c that makes a = BC, it is said that a is divided by B, or B is divided by a, it is recorded

B |;

Division with remainder:

A = QB + R;

This formula is called the remainder of the records with Division R = a mod B;

2. Division nature

1. If a | B and A | C, there is a | bx + c Y for any positive integer x, y;

2. If a | B and B | C, A | C;

3. Set M! = 0, then a | B, if and only when Ma | MB;

4. If a | B and B | A, A = + _ B;

5. If a | B and B! = 0, then | A | <=| B |;

3. Prime Number definition:

If a positive integer A is greater than 1 and can only be divisible by 1, A is called a prime number. If a> 1 is not a prime number,

A is the sum of values. Prime numbers are also called prime numbers.

4. Nature of prime number and combination:

1) if D> 1, p is a prime number and d | P, D = P;

2) If P is a prime number, and p | AB, p | A or p | B;

3) The Union number must have a prime factor, that is, if a union a is set, there is a prime number P, making p |;

5. Basic arithmetic Theorem

If a> 1 is set, a = p1 ^ R1 * P2 ^ R2 * P3 ^ R3 * P4 ^ R4 *......;

P1, P2, P3,... PN are different prime numbers, R1, R1, and positive integers ..

The expression in the theorem can be called the prime factor decomposition of:

For example, 24 = 2*2 ** 2*3;

Inference:

D = p1 ^ S1 * P2 ^ S2 * P3 * S3 ^ P4 * s4 ....

0 <= SI <= Ri; I = 1, 2, K ..

This is a necessary and sufficient condition for positive integer d to be a factor.

Number of all factors:

Formula:

N = (1 + R1) * (1 + R2) * (1 + R3) * (1 + R4) *... * (1 + rn );

For example, 99099 = 3 ^ 2*7*11 ^ 2*13

N = 3*2*3*2 = 36;

6. Evaluate the prime number Method

1. Prime Number embedding method.

For example, if you want to calculate a prime number of less than 100, remove the multiple of the prime number in 10 ..

2. The efficiency is very low when we use the definition method.

Code Implementation of the prime number embedding method:

 1 int A[80000], dp[20000];
2
3 const int inf = 65535;
4
5 int prime( )
6 {
7 int i, j, k = 0;
8 A[1] = 1;
9 for( i = 2; i <= sqrt(inf); i++)
10 for ( j = 2 * i; j <= inf; j += i)
11 A[j] = 1;
12 for( i = 1; i <= inf; i++)
13 if(!A[i])
14 dp[k++] = i;
15 return k;
16 }

  

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.