Divisible review

The first chapter briefly sort out the more interesting content

1. sieve method:

Eratosthenes筛法

Principle: Starting from 2, is not screened out the certain number is a prime number, because it is not any less than its prime divisible, then it is an integer multiple of the number of back screen out

 

 

The method is more efficient linear sieve

Principle: Let each composite number be sifted out his biggest real factor, in turn, that is, when we encounter a number x, it can screen out what number it?

For chestnuts, we scanned the 15 * 3 = 5, then 2 * 15 = 30 15 must be screened out, because really the biggest factor of 30 is 15, then 45 = 3 * 15 should also be screened out.

* Composite number 15 must not be screened out of 15, regardless of

But 5 * 15 it? Can not be screened out, because for 5 * 15, we can find a bigger factor is replaced with 5 off the original smallest prime factor 3 is 5 * 5 = 25, it is really more a factor

Under summary, when we scanned a number x, then weed out 2x, ... pnx until the first pn divisible by x, which is linear sieve principle.

Why is it linear, because each element accessed twice at most.

 

 

Finally, the sieve method is deterministic prime number determination method, which is different from primality testing methods in future we would like to mention, but the sieve method is only applicable to a small range.

 

2. Euclidean algorithm:

This algorithm may seem very simple, but it is the cornerstone of a lot of things

Extended Euclidean algorithm is given as + bt = (a, b) (Bézout's identity) in solution method, which is well demonstrated a and b are relatively prime, then a mold is inverse of b.

Asymptotically Euclidean algorithm and scores continued fraction is also a relationship, we know about both asymptotic score is the score, then their greatest common divisor is 1

The asymptotic fraction expansion in the form of continued fraction is equivalent to running a Euclidean algorithm, leaving the issue to be discussed later when the scores do not even explain

The complexity of the Euclidean algorithm, which is the worst of times the process is equivalent to a Fibonacci columns, complexity is a function of the inverse function of exponential, logarithmic level

The following proof a1, a2 ... an is the greatest common divisor of a linear combination of S = x1 * a1 + x2 * a2 + .... xn * an smallest positive integer that can be represented

Hutchison S is the smallest positive integer s0, obviously d | s0

Here again proved s0 | d set ai = qi * s0 + ri (of Division, ri> = 0)

Then ri S belongs, as taken xi ai is 1, the other taking the linear combination coefficients of 0, s0 * qi qi is a linear combination of times s0 times multiplication, is a linear combination, it belongs to the S ri

Each note is less than ri for s0, s0 is a positive integer and S is the smallest, so that all ri = 0

This makes it all ai = qi * s0, s0 is divisible ai, so that s0 divisible d

Therefore, d = s0.

 

3. integer factorization theorems

This chapter also has an interesting theorem is it, the meaning is obvious, copied here again:

Given positive integers composite number n if a, b such that n | A 2 -b 2  , and n is not divisible ab a + b

Then (n, ab), (n, a + b) is the true factor n

This theorem is widely used in various methods of factoring integers, the Fermat method, continued fraction method, sieve method

Guess you like

Origin www.cnblogs.com/qishihaohaoshuo/p/12026523.html