A special summary of mathematics

Source: Internet
Author: User
Tags modulus

                        数学总结

After feeling the lesson of picks, it is very difficult to find the mathematics in Oi. Although the topic of the recent exam is not difficult, but because I was born out of the formula can not think of the math method IQ catch the gene cause a variety of examinations, the main reason or do less, the method knowledge is not sound, or it is necessary to summarize.

Find the inverse of a number for mod:
Fermat theorem:
P is a prime number, A is a positive integer, A and P coprime, then a^ (p-1) ≡1 (mod p)
So the inverse of a number is a^ (p-2)

Application: Doing division in the case of modulo

Split a number:
(1) the only (but) one decomposition theorem
If an integer is a≥2, then a must be decomposed into the product of several primes (the only form). Ep. 1260=2*2*3*3*5*7.
To split a faster method: first sieve the prime number, and then the minimum quality factor of each of the records down, the last to use which number to split which number.

Application:
Ask for approximate sum, ask about several numbers (the product of the power +1 of each prime number), and then have a variety of questions asked about the deformity

Expanding Euclid's Principle Ax+by=c
First find out GCD D, see if C is divisible by D to determine no solution, and then put A/D,B/D,C/D, find X, Y is a group of solutions
Because
P * A+q * b = Other integer solutions of C are satisfied:
p = p1 + B/GCD (A, b) * t
Q = Q1-A/GCD (A, b) * t (where T is an arbitrary integer)
P, Q is all integer solutions of p * A+q * b = c.

So the smallest positive integer solution of x is ((x*c)%b+b)%b,y is also the same

应用:各种追击问题,相遇问题问最小步数操作数什么的,还有解模线性方程,跟孙子定理也有关

Chinese remainder theorem (Sun Tzu's theorem)

For a x≡2 (mod 3) x≡3 (mod 5) x≡2 (mod 7) solution equation
can be converted to
3 Modular Equations,

X≡1 (mod 3) x≡0 (mod 3) x≡0 (mod 3)
X≡0 (mod 5) x≡1 (mod 5) x≡0 (mod 5)
X≡0 (mod 7) x≡0 (mod 7) x≡1 (mod 7)

And then multiply the coefficients to get rid of the original modulus, the smallest solution of x can be obtained.
2 *70+3*21+2*15≡23 (mod 105)

Euler's theorem a?φ (n) ≡1modn
Euler function φ (x)
? Represents the number of 1~x all and x coprime
? integrable function
? Calculation formula
? Properties
? The number of values for which the GCD of an x is calculated as the number of K: φ (x/k), etc.
? example [Bzoj 2705][bzoj 2818]
Euler's theorem
? promotion to any a,n with an≡anmodφ (p) +φ (p) modp
For coprime a,n There is an≡anmodφ (p) modp
A simple count
Principle of tolerance and repulsion
O DeMorgan theorem
o wrong row problem recursive f[n]= (n-1) * (F[n-1]+f[n-2]);
Is that I have not understood, and then even the examination of the 2 days to fight to play hanging
There are two different types, one is because of the social constraints, the number of solutions, then assume that there is no limit to preprocess the number of scenarios in the array, and then

void dfs(longlong x,longlong y){    if(m<0)        return;    if(x>k)    {        if(y&1)            ans=(ans-f[m])%mod;        else            ans=(ans+f[m]+mod)%mod;        return;    }
m-=l[x]+1;    //因为第x钟至少要l[x]+1个才超限,m剩下的就是这n个随便配的数量,包括第x个(因为可能有l[x]+2,l[x]+3个的可能性)dfs(x+1,y+1);m+=l[x]+1;dfs(x+1,y);

}
The other is the multiples of the numbers in the interval or the multiples of those numbers:

    voidDfsLong LongXLong LongYLong LongZ) {if(x>n) {if(y&1) ans-=r/z-(l1)/z;Elseans+=r/z-(l1)/z;return; } DFS (x+1, y,z);DoubleTmp= (Double) B[X]*Z/GCD (z,b[x]);//double The number of saved is higher than long, but the exact value will be wrong    if(TMP&LT;=R)//Request the LCM with the number selected before and the number to be selected nowDFS (x+1, y+1, TMP);}

Application: Some number of solution number, [L,r] interval how many xx numbers and so on
Möbius inversion:
The essence or the repulsion,
Möbius function
? Defined slightly
? Nature (two-term theorem proof)
? integrable function
? Linear sieve
You can get something that's not good by asking for something you can ask for directly.
Möbius inversion theorem
? The second one is very common in finding gcd and other problems.

When it comes to the value of inversion, a very popular optimization is the bottom function block.
For example F (d) = (n/d) * (M/D) We will find that the value of N/D,M/D will be the same in different intervals,
For example, the first of the current interval is I, then the last of this interval is min (n/(n/i), m/(m/i)) and then +1 gets the first of the next interval, so that we can do a prefix and preprocessing of the Möbius function, which is greatly optimized in computation.
But I often can't get the inverse of the equation.

Combination:
There are many ways of thinking that can help find the number of combinations.
For example, imagine inserting a pole to separate some things, how many empty plugs,
Or think about one, then multiply all the numbers.
C is generally violent + seeking inverse element in addition
The Lucas theorem can be quickly calculated when the modulus value is smaller than the C:
Lucas (m,n) =c (m/p,n/p) *c (m%p,n%p)%p=lucas (m/p,n/p) *c (m%p,n%p)%p.

However, the combination of the formula I still do not expect to push out, or weak, need more practice

Fibonacci Sequence:
In GCD, the most recursive times.
When and only if M is a multiple of N, FN is the approximate FM!
Using matrix multiplication to get a fast power f[i]

Cattleya series.

The O-pass formula is sometimes changed to C (2n,n)/(n+1) because of the different topic requirements.
o Recurrence Relationship
F (n) =f (n-1) * (4*n-2)/(n+1);

Application:
The problem of parentheses. Problem with the stacking order. Divides a multilateral line into a triangular problem. To the top node to form a two-fork tree problem.

One by one correspondence:
What to go south to go North can not go North Ah, in the axis can not go beyond the bounds Ah, is a thought, want to go on a step out of the situation and step down each cross-border situation is the same as the number of programs, so is C (m+n,n)-C (m+n,x+1) or x-1, to see the topic meaning.
However, I am not transparent about this idea. It's only going to be a combination of a shot.

Finally, there are some screening methods to post the ER to my blog's URL.
http://blog.csdn.net/liufengwei1/article/details/46800169

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

A special summary of mathematics

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.