锘??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. 涓涓粠涓婅屼笅鐨刵灞傛牸瀛愶紝mi 涓虹i灞傜殑鏍煎瓙鏁幫紝褰搈i>=mi+1(i=1,2,...,n-1)
錛屽嵆涓婂眰鐨勬牸瀛愭暟涓嶅皯浜庝笅灞傜殑鏍煎瓙鏁版椂錛岀О涔嬩負Ferrers鍥懼儚錛屽鍥?2-6-2)紺恒?nbsp;
鍥?nbsp; (2-6-2) Ferrers鍥懼儚鍏鋒湁濡備笅鎬ц川錛?nbsp; 1.姣忎竴灞傝嚦灝戞湁涓涓牸瀛愩?nbsp; 2.絎竴琛屼笌絎竴鍒椾簰鎹紝絎簩琛屼簬絎簩鍒椾簰鎹紝…錛屽嵆鍥?2-6-3)緇曡櫄綰胯醬鏃嬭漿鎵寰楃殑鍥句粛鐒舵槸Ferrers鍥懼儚銆備袱涓狥errers
鍥懼儚縐頒負涓瀵瑰叡杞殑Ferrers鍥懼儚銆?nbsp; 鍒╃敤Ferrers鍥懼儚鍙緱鍏充簬鏁存暟鎷嗗垎鐨勫崄鍒嗘湁瓚g殑緇撴灉銆?nbsp; (a)鏁存暟n鎷嗗垎鎴恔涓暟鐨勫拰鐨勬媶鍒嗘暟錛屽拰鏁皀鎷嗗垎鎴愪釜鏁扮殑鍜岀殑鎷嗗垎鏁扮浉絳夈?nbsp; 鍥犳暣鏁皀鎷嗗垎鎴恔涓暟鐨勫拰鐨勬媶鍒嗗彲鐢ㄤ竴k琛岀殑鍥懼儚琛ㄧず銆傛墍寰楃殑Ferrers鍥懼儚鐨勫叡杞浘鍍忔渶涓婇潰涓琛屾湁k涓牸瀛愩備緥濡傦細 鍥?nbsp; (2-6-3) (b)鏁存暟n鎷嗗垎鎴愭渶澶氫笉瓚呰繃m涓暟鐨勫拰鐨勬媶鍒嗘暟錛屽拰n鎷嗗垎鎴愭渶澶т笉瓚呰繃m鐨勬媶鍒嗘暟鐩哥瓑銆?
鐞嗙敱鍜?a)鐩哥被浼箋?nbsp; 鍥犳錛屾媶鍒嗘垚鏈澶氫笉瓚呰繃m涓暟鐨勫拰鐨勬媶鍒嗘暟鐨勬瘝鍑芥暟鏄?nbsp; 鎷嗗垎鎴愭渶澶氫笉瓚呰繃m-1涓暟鐨勫拰鐨勬媶鍒嗘暟鐨勬瘝鍑芥暟鏄?nbsp; 鎵浠ユ濂芥媶鍒嗘垚m涓暟鐨勫拰鐨勬媶鍒嗘暟鐨勬瘝鍑芥暟涓?nbsp; (c)鏁存暟n鎷嗗垎鎴愪簰涓嶇浉鍚岀殑鑻ュ共濂囨暟鐨勫拰鐨勭殑鎷嗗垎鏁?鍜宯鎷嗗垎鎴愯嚜鍏辮江鐨凢errers鍥懼儚鐨勬媶鍒嗘暟鐩哥瓑.
璁?nbsp; 鍏朵腑n1>n2>...>nk 鏋勯犱竴涓狥errers鍥懼儚錛屽叾絎竴琛岋紝絎竴鍒楅兘鏄痭1+1鏍鹼紝瀵瑰簲浜?n1+1錛岀浜岃錛岀浜屽垪鍚刵2+1鏍鹼紝瀵瑰簲浜?n2+1銆備互姝ょ被鎺ㄣ傜敱姝ゅ緱鍒扮殑Ferres鍥懼儚鏄叡杞殑銆傚弽榪囨潵涔熶竴鏍楓?nbsp; 渚嬪 17=9+5+3 瀵瑰簲涓篎errers鍥懼儚涓? 鍥?nbsp; (2-6-4) 鍋囧畾n鎷嗗垎涓簄=n1+n2+n3+……+nk錛屼笖n1>=n2>=n3>=……>=nk 鎴戜滑灝嗗畠鎺掑垪鎴愰樁姊艦錛屽乏杈圭湅榻愶紝鎴戜滑鍙互寰楀埌涓涓被浼煎掗樁姊浘鍍忥紝榪欑鍥懼儚鎴戜滑縐頒箣涓篎errers鍥懼儚錛屽瀵逛簬20=10+5+4+1錛屾垜浠湁鍥懼儚錛?/p>
瀵逛簬Ferrers鍥懼儚錛屾垜浠緢瀹規槗鐭ラ亾浠ヤ笅涓ゆ潯鎬ц川錛?/p>
錛?錛?nbsp; 姣忓眰鑷沖皯涓涓牸瀛?o:p> 錛?錛?nbsp; 琛屽垪浜掓崲錛屾墍瀵瑰簲鐨勫浘鍍忎粛涓篎errers鍥懼儚錛屼粬搴旇涓鴻鍥懼儚鐨勫叡杞浘鍍?o:p> 浠繪剰鐨凢errers鍥懼儚瀵瑰簲涓涓暣鏁扮殑鎷嗗垎錛岃屽彲鐢‵errers鍥懼儚鏂逛究鍦拌瘉鏄庯細 錛?錛?nbsp; n鎷嗗垎涓簁涓暣鏁扮殑鎷嗗垎鏁幫紝涓巒鎷嗗垎鎴愭渶澶ф暟涓簁鐨勬媶鍒嗘暟鐩哥瓑 錛?錛?nbsp; n鎷嗗垎涓烘渶澶氫笉瓚呰繃k涓暟鐨勬媶鍒嗘暟錛屼笌n鎷嗗垎鎴愭渶澶ф暟涓嶈秴榪噆鐨勬媶鍒嗘暟鐩哥瓑 錛?錛?nbsp; n鎷嗗垎涓轟簰涓嶇浉鍚岀殑鑻ュ共濂囨暟鐨勬媶鍒嗘暟錛屼笌n鎷嗗垎鎴愬浘鍍忚嚜鍏辮江鐨勬媶鍒嗙殑鎷嗗垎鏁扮浉絳?o:p>
]]>
鍙戜俊浜? flyskyf (flysky), 淇″尯: Algorithm
鏍? 棰? 鎷跨硸鏋滈棶棰?br />
鍙戜俊绔? 姘存湪紺懼尯 (Mon Oct 15 19:07:51 2007), 绔欏唴
鐜版湁4鍫嗙硸鏋?鍒嗗埆涓?,2,4,8
鐢蹭箼涓や漢鍒嗗埆浠庝腑鎷跨硸鏋?br />
瑙勫垯:
1 姣忎漢鍙互浠庢煇涓鍫嗕腑鎷夸換鎰忓涓?br />
2 鐢蹭箼涓や漢浜ゆ浛鎷?br />
3 璋佹嬁鍒版渶鍚庝竴涓硸鏋滄垨鏈鍚庡嚑涓硸鏋滅畻璧?
璇烽棶璋佹湁蹇呰儨鎶婃彙?鎬庢牱瀹炵幇?
鍙戜俊浜? meeme (綾抽福), 淇″尯: Algorithm
鏍? 棰? Re: 鎷跨硸鏋滈棶棰?br />
鍙戜俊绔? 姘存湪紺懼尯 (Mon Oct 15 19:26:32 2007), 绔欏唴
杞垚浜岃繘鍒?br />
1 =0001
2 =0010
4 =0100
8-1 =0111 +
-----------
0222
榪欐牱姣忎釜浣嶄笂閮芥湁涓や釜1銆?br />
姣斿涓綅涓婏紝1鍜?鍦ㄤ釜浣嶄笂閮芥湁涓涓?
瀵規柟涓嶅彲鑳藉悓鏃舵妸榪欎袱涓?鎷胯蛋銆傛墍浠ュ鏂規槸鎷夸笉瀹岀殑銆?br />
瀵規柟鎷垮畬涔嬪悗錛岃嚜宸卞啀鎷胯嫢騫蹭釜璋冩暣鎴愯繖縐嶇姸鎬併?br />
涓棿搴旇鏈変笉灝戣瘉鏄?..
]]>
Ferrers鍥懼儚
璐瑰嫆鏂紙Ferrers錛夊浘璞?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. 璁続, B, C涓轟換鎰忕殑闆嗗悎錛屽垯
(1) A鈮圓
(2) 鑻鈮圔錛屽垯B鈮圓
(3) 鑻鈮圔涓擝鈮圕錛屽垯A鈮圕
3. Cantor瀹氱悊
(1) N涓嶄笌R絳夊娍
(2) 璁続涓轟換鎰忕殑闆嗗悎錛屽垯A涓嶄笌P(A)絳夊娍
4. 鑻ヤ竴涓泦鍚圓涓庢煇涓嚜鐒舵暟n絳夊娍錛屽垯縐癆鏄?strong style="COLOR: red">鏈夌┓闆嗗悎錛屽惁鍒欑ОA涓?span style="COLOR: red">鏃犵┓闆嗗悎銆?/p>
2. 璁続涓轟竴涓泦鍚堬紝濡傛灉A涓換浣曞厓绱犵殑鍏冪礌涔熸槸A鐨勫厓绱狅紝鍒欑ОA涓?strong style="COLOR: red">浼犻掗泦銆傛瘡涓嚜鐒舵暟閮芥槸浼犻掗泦銆?br>浠ヤ笅鍛介絳変環錛?br>(1) A鏄紶閫掗泦
(2) ∪A 鍖呭惈浜?A
(3) 瀵逛簬浠繪剰鐨剏∈A錛寉鍖呭惈浜嶢
(4) A鍖呭惈浜嶱(A)
(5) P(A)涓轟紶閫掗泦
3. 璁続涓轟竴涓泦鍚堬紝縐頒粠A*A鍒癆鐨勫嚱鏁頒負A涓婄殑浜屽厓榪愮畻銆?br>鍙?: N*N -> N錛屼笖瀵逛簬浠繪剰鐨刴, n ∈N錛?(<m, n>) = Am(n), 璁頒綔m + n錛岀О+涓篘涓婄殑鍔犳硶榪愮畻
鍙?#183;: N*N -> N錛屼笖瀵逛簬浠繪剰鐨刴, n ∈N錛?#183;(<m, n>) = Mm(n)錛岃浣渕·n錛岀О·涓篘涓婄殑涔樻硶榪愮畻銆?br>
Peano緋葷粺鏄弧瓚充互涓嬪叕璁劇殑鏈夊簭涓夊厓緇?lt;M, F, e>錛屽叾涓璏涓轟竴涓泦鍚堬紝F涓篗鍒癕鐨勫嚱鏁幫紝e涓洪鍏冪礌銆?鏉″叕璁句負錛?/p>
(1) e ∈M
(2) M鍦‵涓嬫槸灝侀棴鐨?br>(3) e 錕?ranF 錛堟殏鏃跺彧鎵懼埌榪欎釜絎﹀彿琛ㄧず“涓嶅睘浜?#8221; 鍥э級
(4) F鏄崟灝勭殑
(5) 濡傛灉M鐨勫瓙闆咥婊¤凍 (e灞炰簬A) 涓?(A鍦‵涓嬫槸灝侀棴鐨?錛屽垯A=M
(5)縐頒負鏋佸皬鎬у叕璁?br>
2. 璁続涓轟竴涓泦鍚堬紝縐?A∪{A} 涓篈鐨?strong style="COLOR: red">鍚庣戶錛岃浣淎+, 騫剁О姹傞泦鍚堢殑鍚庣戶涓?span style="COLOR: red">鍚庣戶榪愮畻銆?br>
3. 璁続涓轟竴涓泦鍚堬紝鑻婊¤凍錛?br>(1) Ø ∈A錛?br>(2) 鑻ュ浜庝竴鍒?a ∈A錛屽垯 a+ ∈A錛?br>鍒欑ОA鏄?strong style="COLOR: red">褰掔撼闆?/strong>銆?br>
4. 浠庡綊綰抽泦鐨勫畾涔夊彲浠ョ湅鍑猴紝Ø錛?#216;+, Ø++,... 鏄墍鏈夊綊綰抽泦鐨勫厓绱狅紝浜庢槸鍙互灝嗗畠浠畾涔夋垚鑷劧鏁?/strong>銆?br>鑷劧鏁版槸灞炰簬姣忎釜褰掔撼闆嗙殑闆嗗悎錛屽皢Ø錛?#216;+, Ø++,...鍒嗗埆璁頒負0, 1, 2, ...
璁綝={v | v鏄綊綰抽泦|錛岀О∩D涓哄叏浣撹嚜鐒舵暟闆嗗悎錛岃涓篘.
璁綨涓鴻嚜鐒舵暟闆嗗悎錛?#963;: N -> N錛屼笖σ(n) = n+, 鍒?lt;N, σ, Ø>鏄疨eano緋葷粺銆?br>榪欎釜Peano緋葷粺鐨勭(5)鏉″叕璁炬彁鍑轟簡璇佹槑鑷劧鏁版ц川鐨勪竴縐嶆柟娉曪紝鍗?span style="COLOR: red">鏁板褰掔撼娉?/strong>錛岀О姝ゅ叕璁句負鏁板褰掔撼娉曞師鐞?/strong>銆?/p>
]]>
2. Forced Moves 鎺掗櫎鎵鏈夊叾浠栧彲鑳芥у悗鍞竴鐨勭瓟妗?br>
3. Pinned Squares
Intersection 鐨勫姞寮虹増錛屾牴鎹洿澶氱殑鎯呭喌紜畾鏌愪竴涓暟瀛楀湪璇ュ尯鍩熺殑鍞竴鍙兘浣嶇疆銆?br>
4. Locked Sets
濡傚浘涓R5C1鍜孯6C1鍙兘濉?鎴?錛岀敱姝ゅ彲鎺掗櫎涓庝粬浠湁鍏崇殑鍩熶腑鐨勫叾浠栨牸濉?鍜?鐨勫彲鑳芥э紝浠庤孯6C2鍙兘濉?銆?/p>