??xml version="1.0" encoding="utf-8" standalone="yes"?> Exponentiating by squaring is an algorithm used for the fast computation of large integer powers of a number. It is also known as the square-and-multiply algorithm or binary exponentiation. In additive groups the appropriate name is double-and-add algorithm. It implicitly uses the binary expansion of the exponent. It is of quite general use, for example in modular arithmetic. 一个从上而下的n层格子,mi 为第i层的格子敎ͼ当mi>=mi+1(i=1,2,...,n-1)
Q即上层的格子数不少于下层的格子数时Q称之ؓFerrers囑փQ如?2-6-2)C?nbsp;
?nbsp; (2-6-2) Ferrers囑փh如下性质Q?nbsp; 1.每一层至有一个格子?nbsp; 2.W一行与W一列互换,W二行于W二列互换,…Q即?2-6-3)l虚Uu旋{所得的图仍然是Ferrers囑փ。两个Ferrers
囑փUCؓ一对共轭的Ferrers囑փ?nbsp; 利用Ferrers囑փ可得关于整数拆分的十分有的l果?nbsp; (a)整数n拆分成k个数的和的拆分数Q和数n拆分成个数的和的拆分数相{?nbsp; 因整数n拆分成k个数的和的拆分可用一k行的囑փ表示。所得的Ferrers囑փ的共轭图像最上面一行有k个格子。例如: ?nbsp; (2-6-3) (b)整数n拆分成最多不过m个数的和的拆分数Q和n拆分成最大不过m的拆分数相等?
理由?a)相类伹{?nbsp; 因此Q拆分成最多不过m个数的和的拆分数的母函数?nbsp; 拆分成最多不过m-1个数的和的拆分数的母函数?nbsp; 所以正好拆分成m个数的和的拆分数的母函数?nbsp; (c)整数n拆分成互不相同的若干奇数的和的的拆分?和n拆分成自p的Ferrers囑փ的拆分数相等.
?nbsp; 其中n1>n2>...>nk 构造一个Ferrers囑փQ其W一行,W一列都是n1+1|对应?n1+1Q第二行Q第二列各n2+1|对应?n2+1。以此类推。由此得到的Ferres囑փ是共轭的。反q来也一栗?nbsp; 例如 17=9+5+3 对应为Ferrers囑փ? ?nbsp; (2-6-4) 假定n拆分为n=n1+n2+n3+……+nkQ且n1>=n2>=n3>=……>=nk 我们它排列成阶梯ŞQ左边看齐,我们可以得到一个类似倒阶梯图像,q种囑փ我们UC为Ferrers囑փQ如对于20=10+5+4+1Q我们有囑փQ?/p>
对于Ferrers囑փQ我们很Ҏ知道以下两条性质Q?/p>
Q?Q?nbsp; 每层臛_一个格?o:p> Q?Q?nbsp; 行列互换Q所对应的图像仍为Ferrers囑փQ他应该囑փ的共轭图?o:p> L的Ferrers囑փ对应一个整数的拆分Q而可用Ferrers囑փ方便地证明: Q?Q?nbsp; n拆分为k个整数的拆分敎ͼ与n拆分成最大数为k的拆分数相等 Q?Q?nbsp; n拆分为最多不过k个数的拆分数Q与n拆分成最大数不超qk的拆分数相等 Q?Q?nbsp; n拆分Z不相同的若干奇数的拆分数Q与n拆分成图像自p的拆分的拆分数相{?o:p>
]]>
发信? flyskyf (flysky), 信区: Algorithm
? ? 拿糖果问?br />
发信? 水木C (Mon Oct 15 19:07:51 2007), 站内
现有4堆糖?分别?,2,4,8
甲乙两h分别从中拿糖?br />
规则:
1 每h可以从某一堆中拿Q意多?br />
2 甲乙两h交替?br />
3 谁拿到最后一个糖果或最后几个糖果算?
请问谁有必胜把握?怎样实现?
发信? meeme (c鸣), 信区: Algorithm
? ? Re: 拿糖果问?br />
发信? 水木C (Mon Oct 15 19:26:32 2007), 站内
转成二进?br />
1 =0001
2 =0010
4 =0100
8-1 =0111 +
-----------
0222
q样每个位上都有两个1?br />
比如个位上,1?在个位上都有一?
Ҏ不可能同时把q两?拿走。所以对Ҏ拿不完的?br />
Ҏ拿完之后Q自己再拿若q个调整成这U状态?br />
中间应该有不证?..
]]>
Ferrers囑փ
费勒斯(FerrersQ图?o:p>
]]>
Wikipedia上的Catalan numbers:
In combinatorial mathematics, the Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively defined objects. They are named for the Belgian mathematician Eugène Charles Catalan (1814–1894).
The nth Catalan number is given directly in terms of binomial coefficients by
The first Catalan numbers (sequence A000108 in OEIS) for n = 0, 1, 2, 3, … are
An alternative expression for Cn is
This shows that Cn is a natural number, which is not a priori obvious from the first formula given. This expression forms the basis for André's proof of the correctness of the formula (see below under second proof).
The Catalan numbers satisfy the recurrence relation
They also satisfy:
which can be a more efficient way to calculate them.
Asymptotically, the Catalan numbers grow as
in the sense that the quotient of the nth Catalan number and the expression on the right tends towards 1 for n → ∞. (This can be proved by using for n!.)
There are many counting problems in combinatorics whose solution is given by the Catalan numbers. The book Enumerative Combinatorics: Volume 2 by combinatorialist Richard P. Stanley contains a set of exercises which describe 66 different interpretations of the Catalan numbers. Following are some examples, with illustrations of the case C3 = 5.
If the leaves are labelled, we have the quadruple factorial numbers.
There are several ways of explaining why the formula
solves the combinatorial problems listed above. The first proof below uses a generating function. The second and third proofs are examples of bijective proofs; they involve literally counting a collection of some kind of object to arrive at the correct formula.
We start with the observation that several of the combinatorial problems listed above can easily be seen to satisfy the recurrence relation
For example, every Dyck word w of length ≥ 2 can be written in a unique way in the form
with (possibly empty) Dyck words w1 and w2.
The generating function for the Catalan numbers is defined by
As explained in the article titled Cauchy product, the sum on the right side of the above recurrence relation is the coefficient of xn in the product
Therefore
Multiplying both sides by x, we get
So we have
and hence
The square root term can be expanded as a power series using the identity
which can be proved, for example, by the binomial theorem, (or else directly by considering repeated derivatives of ) together with judicious juggling of factorials. Substituting this into the above expression for c(x) produces, after further manipulation,
Equating coefficients yields the desired formula for Cn.
This proof depends on a trick due to D. André, which is now more generally known as the reflection principle (not to be confused with the Schwarz reflection theorem in complex analysis). It is most easily expressed in terms of the "monotonic paths which do not cross the diagonal" problem (see above).
Suppose we are given a monotonic path in an n × n grid that does cross the diagonal. Find the first edge in the path that lies above the diagonal, and flip the portion of the path occurring after that edge, along a line parallel to the diagonal. (In terms of Dyck words, we are starting with a sequence of n X's and n Y's which is not a Dyck word, and exchanging all X's with Y's after the first Y that violates the Dyck condition.) The resulting path is a monotonic path in an (n − 1) × (n + 1) grid. Figure 1 illustrates this procedure; the green portion of the path is the portion being flipped.
Since every monotonic path in the (n − 1) × (n + 1) grid must cross the diagonal at some point, every such path can be obtained in this fashion in precisely one way. The number of these paths is equal to
Therefore, to calculate the number of monotonic n × n paths which do not cross the diagonal, we need to subtract this from the total number of monotonic n × n paths, so we finally obtain
which is the nth Catalan number Cn.
The following bijective proof, while being more involved than the previous one, provides a more natural explanation for the term n + 1 appearing in the denominator of the formula for Cn.
Suppose we are given a monotonic path, which may happen to cross the diagonal. The exceedance of the path is defined to be the number of pairs of edges which lie above the diagonal. For example, in Figure 2, the edges lying above the diagonal are marked in red, so the exceedance of the path is 5.
Now, if we are given a monotonic path whose exceedance is not zero, then we may apply the following algorithm to construct a new path whose exceedance is one less than the one we started with.
The following example should make this clearer. In Figure 3, the black circle indicates the point where the path first crosses the diagonal. The black edge is X, and we swap the red portion with the green portion to make a new path, shown in the second diagram.
Notice that the exceedance has dropped from three to two. In fact, the algorithm will cause the exceedance to decrease by one, for any path that we feed it.
It is also not difficult to see that this process is reversible: given any path P whose exceedance is less than n, there is exactly one path which yields P when the algorithm is applied to it.
This implies that the number of paths of exceedance n is equal to the number of paths of exceedance n − 1, which is equal to the number of paths of exceedance n − 2, and so on, down to zero. In other words, we have split up the set of all monotonic paths into n + 1 equally sized classes, corresponding to the possible exceedances between 0 and n. Since there are
monotonic paths, we obtain the desired formula
Figure 4 illustrates the situation for n = 3. Each of the 20 possible monotonic paths appears somewhere in the table. The first column shows all paths of exceedance three, which lie entirely above the diagonal. The columns to the right show the result of successive applications of the algorithm, with the exceedance decreasing one unit at a time. Since there are five rows, C3 = 5.
The n×n Hankel matrix whose (i, j) entry is the Catalan number Ci+j has determinant 1, regardless of the value of n. For example, for n = 4 we have
Note that if the entries are ``shifted", namely the Catalan numbers Ci+j+1, the determinant is still 1, regardless of the size of n. For example, for n = 4 we have
The Catalan numbers is the unique sequence with this property.
The quadruple factorial is given by , or
. This is the solution to labelled variants of the above combinatorics problems. It is entirely distinct from the multifactorials.
The Catalan sequence was first described in the 18th century by Leonhard Euler, who was interested in the number of different ways of dividing a polygon into triangles. The sequence is named after Eugène Charles Catalan, who discovered the connection to parenthesized expressions. The counting trick for Dyck words was found by D. André in 1887.
2. 设A, B, CZQ意的集合Q则
(1) A≈A
(2) 若A≈BQ则B≈A
(3) 若A≈B且B≈CQ则A≈C
3. Cantor定理
(1) N不与R{势
(2) 设AZQ意的集合Q则A不与P(A){势
4. 若一个集合A与某个自然数n{势Q则UA?strong style="COLOR: red">有穷集合Q否则称A?span style="COLOR: red">无穷集合?/p>
2. 设AZ个集合,如果A中Q何元素的元素也是A的元素,则称A?strong style="COLOR: red">传递集。每个自然数都是传递集?br>以下命题{hQ?br>(1) A是传递集
(2) ∪A 包含?A
(3) 对于L的y∈AQy包含于A
(4) A包含于P(A)
(5) P(A)Z递集
3. 设AZ个集合,UCA*A到A的函CؓA上的二元q算?br>?: N*N -> NQ且对于L的m, n ∈NQ?(<m, n>) = Am(n), Cm + nQ称+为N上的加法q算
?#183;: N*N -> NQ且对于L的m, n ∈NQ?#183;(<m, n>) = Mm(n)Q记作m·nQ称·为N上的乘法q算?br>
Peanopȝ是满以下公讄有序三元l?lt;M, F, e>Q其中MZ个集合,F为M到M的函敎ͼe为首元素?条公设ؓQ?/p>
(1) e ∈M
(2) M在F下是闭?br>(3) e K?ranF Q暂时只扑ֈq个W号表示“不属?#8221; 囧)
(4) F是单的
(5) 如果M的子集A满 (e属于A) ?(A在F下是闭?Q则A=M
(5)UCؓ极小性公?br>
2. 设AZ个集合,U?A∪{A} 为A?strong style="COLOR: red">后Q记作A+, q称求集合的后?span style="COLOR: red">后q算?br>
3. 设AZ个集合,若A满Q?br>(1) Ø ∈AQ?br>(2) 若对于一?a ∈AQ则 a+ ∈AQ?br>则称A?strong style="COLOR: red">归纳?/strong>?br>
4. 从归U集的定义可以看出,ØQ?#216;+, Ø++,... 是所有归U集的元素,于是可以它们定义成自然?/strong>?br>自然数是属于每个归纳集的集合Q将ØQ?#216;+, Ø++,...分别Cؓ0, 1, 2, ...
设D={v | v是归U集|Q称∩D为全体自然数集合Q记为N.
设N然数集合Q?#963;: N -> NQ且σ(n) = n+, ?lt;N, σ, Ø>是Peanopȝ?br>q个Peanopȝ的第(5)条公设提Z证明自然数性质的一U方法,?span style="COLOR: red">数学归纳?/strong>Q称此公设ؓ数学归纳法原?/strong>?/p>
]]>
2. Forced Moves 排除所有其他可能性后唯一的答?br>
3. Pinned Squares
Intersection 的加强版Q根据更多的情况定某一个数字在该区域的唯一可能位置?br>
4. Locked Sets
如图一R5C1和R6C1只能??Q由此可排除与他们有关的域中的其他格??的可能性,从而R6C2只能??/p>