Theoretical Analysis of number theory in algorithm Competitions

Source: Internet
Author: User

I. Basic Concepts

Division algorithm, Division theorem): A ε z, d ε z *, which has a unique integer Q and R, and 0 ≤ r <D0, meet a = D q + R. Q is called the quotient and R is called the remainder. In general, an integer is divided by a positive integer to obtain the quotient and residue ).

Divide exactly: Division B of A. When integer a is divided by a non-zero integer B, the quotient is an integer and the remainder is zero, let's say that a can be divisible by B (or B can be divisible by a), and it is recorded as B |. B is called the divisor of ).

Great common divisor: the largest common divisor of two non-zero integers, A and B, is called D = gcd (A, B ).

Scaled graph equation: a collective name of an Integer Polynomial Equation.

Ii. GCD Euclidean Algorithm

GCD recursion theorem: For any non-negative integer a and any positive integer B, gcd (a, B) = gcd (B, A mod B ). For proof, see the appendix.

Iii. Genus Theorem

Gini theorem: For any integer a, B, linear boosting graph Equation AX + by = m for the X and Y variables ), an integer is obtained only when M is an integer multiple of D = gcd (A, B. For proof, see the appendix.

 

 

Appendix,

Proof of GCD recursion Theorem

Gcd (a, B) = gcd (B, A mod B), First Certificate gcd (a, B) | gcd (B, A mod B ), set d = gcd (a, B), d | A and D | B. Ling

R = (a mod B), then

R = A-QB, Q is a/B Rounded down.

(A mod B) is a linear combination of A and B, so d | (a mod B ).

D | B, d | (a mod B), so d | gcd (B, A mod B ).

In turn, it indicates that gcd (B, A mod B) | gcd (a, B) has the same method and will not be repeated,

Gcd (a, B) = gcd (B, A mod B ).

Proof of the genus Theorem

In AX + by = m,

1. AB = 0, without losing its universality.

B = 0, then

Ax = m. By

D = gcd (A, 0) = A, get

DX = m,

It can be interpreted only when M is an integer multiple of D.

2. AB = 0,

Let A be a linear combination of A and B, that is, a = {XA + Yb | x, y, z },

Make D0 the smallest positive element in a, that is, D0 = min {x | x ε a z *} = x0 A + y0 B,

Next we will first prove that D0 = gcd (a, B), and then construct a group of solutions of the equations to prove the proposition

Adequacy:

Set P to any positive number in A, P = x1a + y1b,

We can prove D0 | P:

Consider P's Division of D0 with remainder,

P = d0q + R, 0 ≤ r <D0, then

R = p-d0q

= X1a + y1b-(x0a + y0b) q

= (X1-qx0) A + (y1-qy0) B,

Because D0 is the smallest positive element in A, R can only be equal to 0, that is, D0 | P.

D0 is the approximate number of positive integers in.

Assume that d Is A and D is the maximum common divisor of any positive integer in a, d | D0, and D0 | D, so D0 = D. In particular

D0 = gcd (| A |, | B |)

= Gcd (A, B ).

Set M = m0d0, D0 = gcd (a, B) = x0 A + y0 B, then

M0 (x0 A + y0 B) = m,

We construct a set of feasible solutions x = m0x0, y = m0y0 for the equations of the sequence.

In fact, the solution can have infinite groups: x = (m0x0 + KB/D0), Y = (m0y0-ka/D0), K, Z.

Necessity: If XA + Yb = m is true, then M is a, D0 | M |, D0 | M.

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.