Sunday, September 7, 2014

Pigeonhole(Drawer) Principle

http://en.wikipedia.org/wiki/Pigeonhole_principle
In mathematics, the pigeonhole principle states that if n items are put into m containers, with n > m, then at least one container must contain more than one item.

In a more quantified generalization: fornatural numbers k and m, if n = km + 1 objects are distributed among m sets, then the pigeonhole principle asserts that one of the sets will contain at least k + 1 objects.[2] For arbitrary n and m this generalizes to k + 1 = ⌊(n - 1)/m⌋ + 1, where ⌊...⌋ is the floor function.
Though the most straightforward application is to finite sets (such as pigeons and boxes), it is also used with infinite sets that cannot be put into one-to-one correspondence. To do so requires the formal statement of the pigeonhole principle, which is "there does not exist an injective function on finite sets whosecodomain is smaller than its domain". Advanced mathematical proofs like Siegel's lemma build upon this more general concept.

下面再给出Ramsey定理的简单形式:
设p,q是正整数,p,q>= 2,则存在最小的正整数R(p,q),使得当n>=R(p,q)时,用红蓝两色涂色Kn的边,则或者存在一个蓝色的完全p边形,或者存在一个红色的完全q边形 。

Wednesday, September 3, 2014

Fast modular exponentiation | Modular arithmetic | Khan Academy

Using modular multiplication rules:
i.e. A^2 mod C = (A * A) mod C = ((A mod C) * (A mod C)) mod C
We can use this to calculate 7^256 mod 13 quickly
7^1 mod 13 = 7
7^2 mod 13 = (7^1 *7^1) mod 13 = (7^1 mod 13 * 7^1 mod 13) mod 13

How can we calculate A^B mod C quickly for any B ?

Step 1: Divide B into powers of 2 by writing it in binary

Start at the rightmost digit, let k=0 and for each digit:
  • If the digit is 1, we need a part for 2^k, otherwise we do not
  • Add 1 to k, and move left to the next digit

Step 2: Calculate mod C of the powers of two ≤ B

5^1 mod 19 = 5
5^2 mod 19 = (5^1 * 5^1) mod 19 = (5^1 mod 19 * 5^1 mod 19) mod 19
5^2 mod 19 = (5 * 5) mod 19 = 25 mod 19
5^2 mod 19 = 6
5^4 mod 19 = (5^2 * 5^2) mod 19 = (5^2 mod 19 * 5^2 mod 19) mod 19
5^4 mod 19 = (6 * 6) mod 19 = 36 mod 19
5^4 mod 19 = 17
5^8 mod 19 = (5^4 * 5^4) mod 19 = (5^4 mod 19 * 5^4 mod 19) mod 19
5^8 mod 19 = (17 * 17) mod 19 = 289 mod 19
5^8 mod 19 = 4
5^16 mod 19 = (5^8 * 5^8) mod 19 = (5^8 mod 19 * 5^8 mod 19) mod 19
5^16 mod 19 = (4 * 4) mod 19 = 16 mod 19
5^16 mod 19 = 16
5^32 mod 19 = (5^16 * 5^16) mod 19 = (5^16 mod 19 * 5^16 mod 19) mod 19
5^32 mod 19 = (16 * 16) mod 19 = 256 mod 19
5^32 mod 19 = 9
5^64 mod 19 = (5^32 * 5^32) mod 19 = (5^32 mod 19 * 5^32 mod 19) mod 19
5^64 mod 19 = (9 * 9) mod 19 = 81 mod 19
5^64 mod 19 = 5

Step 3: Use modular multiplication properties to combine the calculated mod C values

5^117 mod 19 = ( 5^1 * 5^4 * 5^16 * 5^32 * 5^64) mod 19
5^117 mod 19 = ( 5^1 mod 19 * 5^4 mod 19 * 5^16 mod 19 * 5^32 mod 19 * 5^64 mod 19) mod 19
5^117 mod 19 = ( 5 * 17 * 16 * 9 * 5 ) mod 19
5^117 mod 19 = 61200 mod 19 = 1
5^117 mod 19 = 1

Notes:

More optimization techniques exist, but are outside the scope of this article. It should be noted that when we perform modular exponentiation in cryptography, it is not unusual to use exponents for B > 1000 bits.
Read full article from Fast modular exponentiation | Modular arithmetic | Khan Academy

How to find number of prime numbers between two integers - Mathematics Stack Exchange

Let π(x)=#{pxp is prime} be the prime counting function. The Prime Number Theorem tells us that

π(x)xlogx.
(That is limxπ(x)x/logx=1.) So, roughly speaking, around a large x, the probability that an integer is a prime is 1/logx. Thus, naively, one may expect that the number of primes in an interval (x,y], for large x is about (yx)/logx, and in a heuristic formula,
π(y)π(x)(yx)logx=hlogx.()
Here h=yx is the length of the interval. This heuristic makes senses only for h which is much bigger than logx.

From the Prime Number Theorem () holds if hλx, where λ>0 is fixed. From Riemann Hypothesis () holds for hx1/2+ϵ for any fixed ϵ>0. (Because the RH gives the error term in the PNT.) There are unconditional results by Huxley and Heath-Brown showing () for h roughly being x7/12.

If h=logxloglogxloglogloglogxlogloglogx, then () fails for a sequence xn. To deal with `small' intervals Selberg worked with almost all x. Namely he considered () for all xR+S, where |S(0,x]|=o(x). In this sense () holds if h/log2x0 conditionally on RH and for h=x19/77+ϵ unconditionally.

There are also works on the case hλlogx. There the distribution of the number of primes on intervals of this size is Poission with parameter λ, conditionally on the Hardy-Littlewood prime tuple conjecture. I think this is due to Gallagher.


Read full article from How to find number of prime numbers between two integers - Mathematics Stack Exchange

Prime Factorization

Prime Factorization
"Prime Factorization" is finding which prime numbers multiply together to make the original number.

Example 1: What are the prime factors of 12 ?

12 = 2 × 2 × 3
As you can see, every factor is a prime number, so the answer must be right.

Factor Tree
And a "Factor Tree" can help: find any factors of the number, then the factors of those numbers, etc, until we can't factor any more.

http://en.wikipedia.org/wiki/Prime_factor
Perfect square numbers can be recognized by the fact that all of their prime factors have even multiplicities. For example, the number 144 (the square of 12) has the prime factors
 144 = 2 \times 2 \times 2 \times 2 \times 3 \times 3 = 2^4 \times 3^2.
These can be rearranged to make the pattern more visible:
 144 = 2 \times 2 \times 2 \times 2 \times 3 \times 3 = (2 \times 2 \times 3) \times (2 \times 2 \times 3) = (2 \times 2 \times 3)^2 = (12)^2.
Because every prime factor appears an even number of times, the original number can be expressed as the square of some smaller number. In the same way, perfect cube numbers will have prime factors whose multiplicities are multiples of three, and so on.
Why find Prime Factors?
A prime number can only be divided by 1 or itself, so it cannot be factored any further!
Every other whole number can be broken down into prime number factors.
2 and 2 and 3
It is like the Prime Numbers are the basic building blocks of all numbers.
This can be very useful when working with big numbers, such as in Cryptography.
Cryptography
Cryptography is the study of secret codes. Prime Factorization is very important to people who try to make (or break) secret codes based on numbers.
That is because factoring very large numbers is very hard, and can take computers a long time to do.
If you want to know more, the subject is "encryption" or "cryptography".
Unique
And here is another thing:
There is only one (unique!) set of prime factors for any number.
Example The prime factors of 330 are 2, 3, 5 and 11:
330 = 2 × 3 × 5 × 11
There is no other possible set of prime numbers that can be multiplied to make 330.
In fact this idea is so important it is called the Fundamental Theorem of Arithmetic.
Read full article from Prime Factorization

Saturday, August 30, 2014

完全弹性碰撞_百度百科

http://en.wikipedia.org/wiki/Elastic_collision
An elastic collision is an encounter between two bodies in which the total kinetic energy of the two bodies after the encounter is equal to their total kinetic energy before the encounter. Elastic collisions occur only if there is no net conversion of kinetic energy into other forms.

完全弹性碰撞(Perfect Elastic Collision) 在理想情况下,完全弹性碰撞的物理过程满足动量守恒能量守恒。如果两个碰撞小球的质量相等,联立动量守恒能量守恒方程时可解得:两个小球碰撞后交换速度。如果被碰撞的小球原来静止,则碰撞后该小球具有了与碰撞小球一样大小的速度,而碰撞小球则停止。多个小球碰撞时可以进行类似的分析。事实上,由于小球间的碰撞并非理想的弹性碰撞,还会有能量的损失,所以最后小球还是要停下来。
讨论两个球的碰撞过程。碰撞过程可分为两个过程。开始碰撞时,两球相互挤压,发生形变,由形变产生的弹性恢复力使两球的速度发生变化,直到两球的速度变得相等为止。这时形变得到最大。这是碰撞的第一阶段,称为压缩阶段。此后,由于形变仍然存在,弹性恢复力继续作用,使两球速度改变而有相互脱离接触的趋势,两球压缩逐渐减小,直到两球脱离接触时为止。这是碰撞的第二阶段,称为恢复阶段。整个碰撞过程到此结束。

碰撞分类

根据碰撞过程动能是否守恒分为
1)完全弹性碰撞:碰撞前后系统动能守恒(能完全恢复原状);
2)非弹性碰撞:碰撞前后系统动能不守恒(部分恢复原状);
3)完全非弹性碰撞:碰撞后系统以相同的速度运动(完全不能恢复原状)。
Read full article from 完全弹性碰撞_百度百科

Labels

Popular Posts