the online math open winter contest o cial solutions...

28
The Online Math Open Winter Contest Official Solutions January 4, 2013–January 15, 2013

Upload: lydat

Post on 11-Mar-2018

218 views

Category:

Documents


1 download

TRANSCRIPT

The Online Math Open Winter ContestOfficial Solutions

January 4, 2013–January 15, 2013

Acknowledgments

Contest Directors

Ray Li, James Tao, Victor Wang

Head Problem Writers

Evan Chen, Ray Li, Victor Wang

Additional Problem Contributors

James Tao, Anderson Wang, David Yang, Alex Zhu

Proofreaders and Test Solvers

Evan Chen, Calvin Deng, Mitchell Lee, James Tao, Anderson Wang, David Yang, Alex Zhu

Website Manager

Ray Li

LATEX/Document Manager

Evan Chen

Contest Information

Format

The test will start Friday, January 4 and end Tuesday, January 15 (ignore the previous deadline of Monday,January 14). You will have until 7pm EST on January 15 to submit your answers; see here for submissionprocedures. The test consists of 50 short answer questions, each of which has a nonnegative integer answerno greater than 263−2 = 9223372036854775806. The problem difficulties range from those of AMC problemsto those of Olympiad problems. Problems are ordered in roughly increasing order of difficulty.

Team Guidelines

Students may compete in teams of up to four people. Participating students must not have graduated fromhigh school. International students may participate. No student can be a part of more than one team. Themembers of each team do not get individual accounts; they will all share the team account.

Each team will submit its final answers through its team account. Though teams can save drafts for theiranswers, the current interface does not allow for much flexibility in communication between team members.We recommend using Google Docs and Spreadsheets to discuss problems and compare answers, especially ifteammates cannot communicate in person. Teams may spend as much time as they like on the test beforethe deadline.

Aids

Drawing aids such as graph paper, ruler, and compass are permitted. However, electronic drawing aids arenot allowed. This is includes (but is not limited to) Geogebra and graphing calculators. Published printand electronic resources are not permitted. (This is a change from last year’s rules.)

Four-function calculators are permitted on the Online Math Open. That is, calculators which perform onlythe four basic arithmetic operations (+-*/) may be used. Any other computational aids such as scientificand graphing calculators, computer programs and applications such as Mathematica, and online databasesare prohibited. All problems on the Online Math Open are solvable without a calculator. Four-functioncalculators are permitted only to help participants reduce computation errors.

Clarifications

Clarifications will be posted as they are answered. For the Winter 2012-2013 Contest, they will be postedhere. If you have a question about a problem, please email [email protected] with “Clari-fication” in the subject. We have the right to deny clarification requests that we feel we cannot answer.

Scoring

Each problem will be worth one point. Ties will be broken based on the “hardest” problem that a teamanswered correctly. Remaining ties will be broken by the second hardest problem solved, and so on. ProblemX is defined to be “harder” than Problem Y if and only if

(i) X was solved by less teams than Y , OR

(ii) X and Y were solved by the same number of teams and X appeared later in the test than Y .

Note: This is a change from prior tiebreaking systems. However, we will still order theproblems by approximate difficulty.

Results

After the contest is over, we will release the answers to the problems within the next day. If you have aprotest about an answer, you may send an email to [email protected] (Include “Protest”in the subject). Solutions and results will be released in the following weeks.

January 2013 Winter OMO 2012-2013 Page 1

1. Let x be the answer to this problem. For what real number a is the answer to this problem also a−x?

Answer. 0 .

Solution. a = x, so a− x = 0 must be the answer.

This problem was proposed by Ray Li.

2. The number 123454321 is written on a blackboard. Evan walks by and erases some (but not all) of thedigits, and notices that the resulting number (when spaces are removed) is divisible by 9. What is thefewest number of digits he could have erased?

Answer. 2 .

Solution. The sum of the digits needs to be divisible by 9, so we need to remove 7 at minimum. Sincethere is no 7, we can remove a 2 and a 5 or a 3 and a 4: 2 digits.

This problem was proposed by Ray Li. This solution was given by ahaanomegas on AoPS.

3. Three lines m, n, and ` lie in a plane such that no two are parallel. Lines m and n meet at an acuteangle of 14◦, and lines m and ` meet at an acute angle of 20◦. Find, in degrees, the sum of all possibleacute angles formed by lines n and `.

Answer. 40 .

Solution. There are two possible angles: 20◦ − 16◦ and 20◦ + 16◦ (note that both are acute), so thesum is 2 · 20◦ = 40◦.

This problem was proposed by Ray Li.

4. For how many ordered pairs of positive integers (a, b) with a, b < 1000 is it true that a times b is equalto b2 divided by a? For example, 3 times 9 is equal to 92 divided by 3.

Figure 1: xkcd 759

Answer. 31 .

Solution. ab = b2

a is equivalent to a2 = b, so we simply want the number of perfect squares less than1000, or 31.

This problem was proposed by Ray Li.

5. At the Mountain School, Micchell is assigned a submissiveness rating of 3.0 or 4.0 for each class hetakes. His college potential is then defined as the average of his submissiveness ratings over all classestaken. After taking 40 classes, Micchell has a college potential of 3.975. Unfortunately, he needs acollege potential of at least 3.995 to get into the South Harmon Institute of Technology. Otherwise,he becomes a rock. Assuming he receives a submissiveness rating of 4.0 in every class he takes fromnow on, how many more classes does he need to take in order to get into the South Harmon Instituteof Technology?

Answer. 160 .

January 2013 Winter OMO 2012-2013 Page 2

Solution. If at any point Micchell has a and b ratings of 4.0 and 3.0, respectively, his college potentialis 4a+3b

a+b = 4− ba+b . Thus after taking 40 classes, he has received exactly one submissiveness rating of

3.0. In order to get his college potential up to at least 3.995, he needs 4 − 1x ≥ 3.995, where x is the

number of total classes taken (including the original 40); solving, we get x ≥ 200. Since x = 200 alsosuffices, Micchell needs to take at least 200− 40 = 160 more classes.

In other words, he should clearly just try to be a rock.

This problem was proposed by Victor Wang.

6. Circle S1 has radius 5. Circle S2 has radius 7 and has its center lying on S1. Circle S3 has an integerradius and has its center lying on S2. If the center of S1 lies on S3, how many possible values are therefor the radius of S3?

Answer. 11 .

Solution. By the triangle inequality, the possible radii are those between 7 − 5 and 7 + 5, giving us11 possible values.

This problem was proposed by Ray Li.

7. Jacob’s analog clock has 12 equally spaced tick marks on the perimeter, but all the digits have beenerased, so he doesn’t know which tick mark corresponds to which hour. Jacob takes an arbitrary tickmark and measures clockwise to the hour hand and minute hand. He measures that the minute handis 300 degrees clockwise of the tick mark, and that the hour hand is 70 degrees clockwise of the sametick mark. If it is currently morning, how many minutes past midnight is it?

Answer. 500 .

Solution. The hour’s degree from the closest tick mark is 10 degrees clockwise, which means 20minutes. This is 120 degrees clockwise from tick mark 12. So Jacob chooses tick mark 6, and thecurrent time is 8:20, so 500 minutes.

This problem was proposed by Ray Li. This solution was given by chaotic iak on AoPS.

8. How many ways are there to choose (not necessarily distinct) integers a, b, c from the set {1, 2, 3, 4}such that a(b

c) is divisible by 4?

Answer. 28 .

Solution. Basic casework. Note that, if a = 1 or a = 3, the power is going to be odd, so no change of4-divisibility. The interesting part is a = 2 and a = 4.

If a = 2, as long as bc ≥ 2, we’re good. If b = 1, bc = 1, so that fails. If b = 2, b = 3, or b = 4, we have4 choices of c for each, making 12.

If a = 4, all combinations of b and c work. There are 42 = 16 ways we can do this.

Thus, the answer is 12 + 16 = 28.

This problem was proposed by Ray Li. This solution was given by ahaanomegas on AoPS.

9. David has a collection of 40 rocks, 30 stones, 20 minerals and 10 gemstones. An operation consists ofremoving three objects, no two of the same type. What is the maximum number of operations he canpossibly perform?

Answer. 30 .

January 2013 Winter OMO 2012-2013 Page 3

Solution. Each move uses at least one mineral or gemstone, so we cannot do better than 30. (Al-ternatively, as mcdonalds106 7 notes on AoPS, we can note that each move uses at least two stones,minerals, or gemstones.) On the other hand, this is easily achieved by taking a rock and a stone (andthen either a mineral or a gemstone) each time.

This problem was proposed by Ray Li.

10. At certain store, a package of 3 apples and 12 oranges costs 5 dollars, and a package of 20 apples and5 oranges costs 13 dollars. Given that apples and oranges can only be bought in these two packages,what is the minimum nonzero amount of dollars that must be spent to have an equal number of applesand oranges?

Answer. 64 .

Solution. The (signed) difference between apples and oranges (aka apples - oranges) must be 0. Thefirst package gives a difference −9 while the second gives +15, so we need to have 5 of the first packagesand 3 of the second packages for 64 dollars. (Just to check, there are 75 apples and 75 oranges now.)

This problem was proposed by Ray Li. This solution was given by chaotic iak on AoPS.

11. Let A, B, and C be distinct points on a line with AB = AC = 1. Square ABDE and equilateraltriangle ACF are drawn on the same side of line BC. What is the degree measure of the acute angleformed by lines EC and BF?

Answer. 75 .

Solution. The desired angle is just ∠FBC + ∠ECB = 180◦−120◦2 + 45◦ = 75◦, where we use the fact

that AB = AF .

This problem was proposed by Ray Li.

12. There are 25 ants on a number line; five at each of the coordinates 1, 2, 3, 4, and 5. Each minute,one ant moves from its current position to a position one unit away. What is the minimum number ofminutes that must pass before it is possible for no two ants to be on the same coordinate?

Answer. 126 .

Solution. Consider the sum of the (absolute) distances from the original centroid (3) of the ants toeach of the ants. This quantity changes by at most 1 each time, so the answer is at least (0 + 1 + 1 +· · ·+ 12 + 12)− 5(0 + 1 + 1 + 2 + 2) = 126, which is clearly achievable (as long as we don’t go beyond3± 12).

This problem was proposed by Ray Li.

13. There are three flies of negligible size that start at the same position on a circular track with circum-ference 1000 meters. They fly clockwise at speeds of 2, 6, and k meters per second, respectively, wherek is some positive integer with 7 ≤ k ≤ 2013. Suppose that at some point in time, all three flies meetat a location different from their starting point. How many possible values of k are there?

Answer. 501 .

Solution. Working modulo 1000 (allowing fractional parts, as we do mod 1) tells us that preciselyk ≡ 2 (mod 4) work.

This problem was proposed by Ray Li.

14. What is the smallest perfect square larger than 1 with a perfect square number of positive integerfactors?

January 2013 Winter OMO 2012-2013 Page 4

Answer. 36 .

Solution. Clearly our number will either be of the form p8 or p2q2, so our answer is 62 = 36. (Anythingwith at least three distinct prime factors will be at least 302.)

This problem was proposed by Ray Li.

15. A permutation a1, a2, . . . , a13 of the numbers from 1 to 13 is given such that ai > 5 for i = 1, 2, 3, 4, 5.Determine the maximum possible value of

aa1 + aa2 + aa3 + aa4 + aa5 .

Answer. 45 .

Solution. a1 through a5 take up 5 numbers greater than 5, so we can’t do better than 13 + 12 +11 + 5 + 4 = 45. This is achieved whenever {a1, . . . , a5} = {6, 7, 8, 9, 10} and {a6, a7, a8, a9, a10} ={4, 5, 11, 12, 13}.

This problem was proposed by Evan Chen.

16. Let S1 and S2 be two circles intersecting at points A and B. Let C and D be points on S1 andS2 respectively such that line CD is tangent to both circles and A is closer to line CD than B. If∠BCA = 52◦ and ∠BDA = 32◦, determine the degree measure of ∠CBD.

Answer. 48 .

Solution. Note that ∠CBA = ∠DCA,∠DBA = ∠CDA. Let ∠CBA = x,∠DBA = y; then∠CBD = x + y, ∠BCD = 52 + x, ∠CDB = 32 + y. Therefore, 2(x + y) + 52 + 32 = 180 yields∠CBD = 180−52−32

2 = 48◦.

This problem was proposed by Ray Li. This solution was given by thugzmath10 on AoPS.

17. Determine the number of ordered pairs of positive integers (x, y) with y < x ≤ 100 such that x2 − y2and x3 − y3 are relatively prime. (Two numbers are relatively prime if they have no common factorother than 1.)

Answer. 99 .

Solution. Clearly we need x− y = 1. It’s easy to check that gcd(x+ y, x2 + xy + y2) = 1 for all suchx, y, so the answer is 99.

This problem was proposed by Ray Li.

18. Determine the absolute value of the sum

b2013 sin 0◦c+ b2013 sin 1◦c+ · · ·+ b2013 sin 359◦c,

where bxc denotes the greatest integer less than or equal to x.

(You may use the fact that sinn◦ is irrational for positive integers n not divisible by 30.)

Answer. 178 .

Solution. bxc+ b−xc = −1 when x is not an integer, so from sin(x+π) = − sin(x) we get ans answeris −178 + b1c+ b−1c = 0.

This problem was proposed by Ray Li.

19. A,B,C are points in the plane such that ∠ABC = 90◦. Circles with diameters BA and BC meet atD. If BA = 20 and BC = 21, then the length of segment BD can be expressed in the form m

n wherem and n are relatively prime positive integers. What is m+ n?

January 2013 Winter OMO 2012-2013 Page 5

Answer. 449 .

Solution. Let the circle with diameter BA intersect AC at E. Similarly, let the circle with diameterBC intersect AC at F . We easily find ∠BDA = 90 and ∠BFC = 90, so E and F are the same point,the intersection of AC and the altitude from B. The answer follows.

This problem was proposed by Ray Li. This solution was given by BOGTRO on AoPS.

20. Let a1, a2, . . . , a2013 be a permutation of the numbers from 1 to 2013. Let An = a1+a2+···+ann for

n = 1, 2, . . . , 2013. If the smallest possible difference between the largest and smallest values ofA1, A2, . . . , A2013 is m

n , where m and n are relatively prime positive integers, find m+ n.

Answer. 3 .

Solution. Looking at |A1 − A2| we see the answer is at least 1/2. Equality can be achieved by1007, 1008, 1006, 1009, 1005, . . ..

This problem was proposed by Ray Li.

21. Dirock has a very neat rectangular backyard that can be represented as a 32× 32 grid of unit squares.The rows and columns are each numbered 1, 2, . . . , 32. Dirock is very fond of rocks, and places a rockin every grid square whose row and column number are both divisible by 3. Dirock would like to builda rectangular fence with vertices at the centers of grid squares and sides parallel to the sides of theyard such that

a) The fence does not pass through any grid squares containing rocks;

b) The interior of the fence contains exactly 5 rocks.

In how many ways can this be done?

Answer. 1920 .

Solution. 5 rocks? In a rectangle? Oh no I guess the only way to do that is have 5 rocks in a row.What a rocky start to a rocky problem. Or maybe it’s not that unfortunate.

For each row (with rocks), there are 10 rocks so there are 6 sequences of 5 consecutive rocks. There are10 rows, and also we can have both vertical and horizontal groups of rocks, so we have the 6×10×2 = 120groups of 5 abiotic likenesses of Geodudes (substitute Gravelers and Golems as necessary).

Let’s construct a frame for each of our 5-rock gardens. There are 2 possible top boundaries, 2 possiblelower boundaries, 2 possible left boundaries, and 2 possible right boundaries, so there are 24 = 16different frames we can choose from. And what do you know, everything is conveniently symmetric:it’s the same for every group of rocks. WOW WHAT A COINCIDENCE I guess we must be lucky toget this problem huh

So by the multiplication principle (which everyone knows but like no one actually knows by name),

our answer is 120 × 16 = 1920 = year of ratification of 19th amendment so clearly the test writerswanted to make a point about women’s suffrage.

This problem was proposed by Ray Li. This solution was given by Past on AoPS.

22. In triangle ABC, AB = 28, AC = 36, and BC = 32. Let D be the point on segment BC satisfying∠BAD = ∠DAC, and let E be the unique point such that DE ‖ AB and line AE is tangent to thecircumcircle of ABC. Find the length of segment AE.

Answer. 18 .

January 2013 Winter OMO 2012-2013 Page 6

Solution. We have BD = 28·3228+36 = 14 and CD = 32−14 = 18. Since DE ‖ AB, ∠CDE = ∠CBA and

∠BAD = ∠EDA. But ∠ABC = ∠CAE, so it follows that ∠CDE = ∠CBA (which implies AECDis cyclic), ∠CAD = ∠EDA and ∠CDA = ∠EAD. As AD is the common segment of triangles CADand EDA, by ASA Congurence Postulate we have 4CAD ∼= 4EDA. Therefore, AE = CD = 18.

This problem was proposed by Ray Li. This solution was given by thugzmath10 on AoPS.

23. A set of 10 distinct integers S is chosen. Let M be the number of nonempty subsets of S whoseelements have an even sum. What is the minimum possible value of M?

Answer. 511 .

Clarifications.

• S is the “set of 10 distinct integers” from the first sentence.

Solution. If all the elements are even we get 210−1. If at least one is odd then we get at least 12210−1,

which is achieved by all 1s, for instance.

This problem was proposed by Ray Li.

24. For a permutation π of the integers from 1 to 10, define

S(π) =

9∑i=1

(π(i)− π(i+ 1)) · (4 + π(i) + π(i+ 1)),

where π(i) denotes the ith element of the permutation. Suppose that M is the maximum possible valueof S(π) over all permutations π of the integers from 1 to 10. Determine the number of permutationsπ for which S(π) = M .

Answer. 40320 .

Solution. The sum telescopes, giving us an answer of 8! = 40320.

This problem was proposed by Ray Li.

25. Positive integers x, y, z ≤ 100 satisfy

1099x+ 901y + 1110z = 59800

109x+ 991y + 101z = 44556

Compute 10000x+ 100y + z.

Answer. 34316 .

Solution. Subtracting the first equation from 11 times the second, we obtain 100x + 10000y + z =430316. Since x, y, z ≤ 100 this implies (x, y, z) = (3, 43, 16), so 10000x+ 100y + z = 34316.

Solution 2. Taking the equations modulo 100, we obtain −x + y + 10z ≡ 0 (mod 100) and 9x −9y + z ≡ 56 (mod 100), whence 91z ≡ 56 (mod 100). But 9 · 11 = 99 ≡ −1 (mod 100) meansz ≡ 11 · 91z ≡ 11 · 56 ≡ 16 (mod 100), so z = 16.

On the other hand, subtracting the former from 10 times the latter gives −9x+9009y−100z = 385760,so

385760 + 1600 + 9 ≤ 9009y ≤ 385760 + 1600 + 900 =⇒ y = 43,

since 1 ≤ x, y, z ≤ 100 are positive integers (observe that 9009 · 43 = 387387). Finally, x ≡ y + 10z ≡43 + 60 ≡ 3 (mod 100), so (x, y, z) = (3, 43, 16) and 10000x+ 100y + z = 34316.

January 2013 Winter OMO 2012-2013 Page 7

This problem was proposed by Evan Chen. The second solution was given by Victor Wang.

26. In triangle ABC, F is on segment AB such that CF bisects ∠ACB. Points D and E are on line CFsuch that lines AD,BE are perpendicular to CF . M is the midpoint of AB. If ME = 13, AD = 15,and BE = 25, find AC + CB.

Answer. 104 .

Solution. Note that 4BEF is similar to 4ADF , with scale factor 5 to 3. If we let EF = 5a, thenDF = 3a. Also note that 4ADC is similar to 4BEC, with scale factor 5 to 3. Since DE = 8a,CD = 12a. By Pythagorean theorem, AF = 3

√a2 + 25 and BF = 5

√a2 + 25. Also by Pythagorean

theorem, AE =√

64a2 + 125.

By Stewart’s theorem on triangle AEB using ME, AM , and BM as sides in the calculation, we have(letting AM = BM = x)

625x+ (64a2 + 225)x = 2x · x · x+ 2x · 169,

so 850 + 64a2 = 2x2 + 338 and x = 4√

2a2 + 16. So 2x = AB = 8√

2a2 + 16 but this also equalsAF +BF or 8

√a2 + 25 so equating them we get a = 3 and AC = 39, BC = 65 so the answer is then

104.

This problem was proposed by Ray Li.

27. Geodude wants to assign one of the integers 1, 2, 3, . . . , 11 to each lattice point (x, y, z) in a 3D Cartesiancoordinate system. In how many ways can Geodude do this if for every lattice parallelogram ABCD,the positive difference between the sum of the numbers assigned to A and C and the sum of thenumbers assigned to B and D must be a multiple of 11? (A lattice point is a point with all integercoordinates. A lattice parallelogram is a parallelogram with all four vertices lying on lattice points.Here, we say four not necessarily distinct points A,B,C,D form a parallelogram ABCD if and only ifthe midpoint of segment AC coincides with the midpoint of segment BD.)

Answer. 14641 .

Clarifications.

• The “positive difference” between two real numbers x and y is the quantity |x − y|. Note thatthis may be zero.

• The last sentence was added to remove confusion about “degenerate parallelograms.”

Solution. Let f(x, y, z) be the number written at (x, y, z), and g(x, y, z) = f(x, y, z)−f(0, 0, 0). Thenconsidering all parallelograms ABCD with A = (0, 0, 0), we get

11 | g(x1 + x2, y1 + y2, z1 + z2)− g(x1, y1, z1)− g(x2, y2, z2)

for all integers x1, y1, . . . , z2. But then it’s not hard to prove

g(x, y, z) ≡ xg(1, 0, 0) + yg(0, 1, 0) + zg(0, 0, 1) (mod 11)

for all integers x, y, z. (Try it!)

On the other hand, any choice of f(0, 0, 0), g(1, 0, 0), g(0, 1, 0), and g(0, 0, 1) yields a distinct workingassignment f (Why?), so the desired answer is 114 = 14641.

This problem was proposed by Victor Wang.

January 2013 Winter OMO 2012-2013 Page 8

28. Let S be the set of all lattice points (x, y) in the plane satisfying |x|+ |y| ≤ 10. Let P1, P2, . . . , P2013

be a sequence of 2013 (not necessarily distinct) points such that for every point Q in S, there existsat least one index i such that 1 ≤ i ≤ 2013 and Pi = Q. Suppose that the minimum possible valueof |P1P2|+ |P2P3|+ · · ·+ |P2012P2013| can be expressed in the form a+ b

√c, where a, b, c are positive

integers and c is not divisible by the square of any prime. Find a + b + c. (A lattice point is a pointwith all integer coordinates.)

Answer. 222 .

Clarifications.

• k = 2013, i.e. the problem should read, “. . . there exists at least one index i such that 1 ≤ i ≤ 2013. . . ”. An earlier version of the test read 1 ≤ i ≤ k.

Solution. More generally, let Sn be the set of all lattice points (x, y) such that |x| + |y| ≤ n. Color(x, y) black if x + y − n is even and white otherwise. Notice that there are (n + 1)2 black points andn2 white points, so there are at least 2n segments in this broken line that go from a black point to ablack point, and the length of each such segment is at least

√2. There are 2n2 + 2n total segments, so

the length of the broken line is at least 2n2 + 2n√

2. The construction is not hard to find (basically aspiral).

This problem was proposed by Anderson Wang.

29. Let φ(n) denote the number of positive integers less than or equal to n that are relatively prime to n,and let d(n) denote the number of positive integer divisors of n. For example, φ(6) = 2 and d(6) = 4.Find the sum of all odd integers n ≤ 5000 such that n | φ(n)d(n).

Answer. 2903 .

Solution. Note 38 > 5000, so all primes dividing n are at most 8 and thus 3, 5, or 7. Doing caseworkon the set of primes (hardest part is 36 · 7 = 5103 > 5000) we get 1 + 32 + 35 + 54 + 34 · 52.

This problem was proposed by Alex Zhu.

30. Pairwise distinct points P1, P2, . . . , P16 lie on the perimeter of a square with side length 4 centered atO such that |PiPi+1| = 1 for i = 1, 2, . . . , 16. (We take P17 to be the point P1.) We construct pointsQ1, Q2, . . . , Q16 as follows: for each i, a fair coin is flipped. If it lands heads, we define Qi to be Pi;otherwise, we define Qi to be the reflection of Pi over O. (So, it is possible for some of the Qi to

coincide.) Let D be the length of the vector−−→OQ1 +

−−→OQ2 + · · · +

−−−→OQ16. Compute the expected value

of D2.

Answer. 88 .

Solution. What’s∑

(±a± b± c)2 over all 23 = 8 choices of signs depends only on a2 + b2 + c2. Thisgeneralizes!

This problem was proposed by Ray Li.

31. Beyond the Point of No Return is a large lake containing 2013 islands arranged at the vertices of aregular 2013-gon. Adjacent islands are joined with exactly two bridges. Christine starts on one of theislands with the intention of burning all the bridges. Each minute, if the island she is on has at leastone bridge still joined to it, she randomly selects one such bridge, crosses it, and immediately burns it.Otherwise, she stops.

If the probability Christine burns all the bridges before she stops can be written as mn for relatively

prime positive integers m and n, find the remainder when m+ n is divided by 1000.

Answer. 113 .

January 2013 Winter OMO 2012-2013 Page 9

Solution. We either cycle through the whole 2013-gon first (after which Christine will automaticallysucceed) or “retrace” first right after passing through k ∈ [1, 2012] bridges. In the first case we have aprobability of

(4/4)(2/3)2012(2/2)(1/1)2012 = (2/3)2012;

in the second we have

(4/4)(2/3)k−1(1/3)(1/1)k−1(2/2)(2/3)2012−k(1/1)2013−k = (1/3)(2/3)2011.

Summing up we get 1007(2/3)2012 so m = 1007 · 22012 and n = 32012 (since 3 - 1007). Our answer isthus

1007 · 22012 + 32012 ≡ 7 · 212 + 312 ≡ 113 (mod 1000).

(To speed up calculations, we can work mod 8 and mod 125 first and then use CRT.)

This problem was proposed by Evan Chen.

32. In 4ABC with incenter I, AB = 61, AC = 51, and BC = 71. The circumcircles of triangles AIBand AIC meet line BC at points D (D 6= B) and E (E 6= C), respectively. Determine the length ofsegment DE.

Answer. 41 .

Solution. Angle chasing gives 4IDC ∼= 4IAC, so CA = CD and similarly, BA = BE. ThusDE = BE + CD −BC = AB +AC −BC = 41.

Comment. I is the circumcenter of 4ADE, and D,E always lie on the same side of line AI as B,C,respectively. This gives us another way to define D,E.

This problem was proposed by James Tao.

33. Let n be a positive integer. E. Chen and E. Chen play a game on the n2 points of an n × n latticegrid. They alternately mark points on the grid such that no player marks a point that is on or insidea non-degenerate triangle formed by three marked points. Each point can be marked only once. Thegame ends when no player can make a move, and the last player to make a move wins. Determine thenumber of values of n between 1 and 2013 (inclusive) for which the first player can guarantee a win,regardless of the moves that the second player makes.

Answer. 1007 .

Solution. If n is odd, the first player should take the center square. Then for the second player’smove, the first player should choose the reflection across the center square. It is clear that this will notbe in the convex hull of the chosen points. So here the first player always wins.

If n is even, then the second player should take the reflection across the center square. So the secondplayer always win in this case.

The answer is thus 1007.

This problem was proposed by Ray Li. This solution was given by Yang Liu.

34. For positive integers n, let s(n) denote the sum of the squares of the positive integers less than or equalto n that are relatively prime to n. Find the greatest integer less than or equal to∑

n|2013

s(n)

n2,

where the summation runs over all positive integers n dividing 2013.

January 2013 Winter OMO 2012-2013 Page 10

Answer. 671 .

Solution. We have ∑n|N

s(n)

n2=

12 + 22 + · · ·+N2

N2=

(N + 1)(2N + 1)

6N.

Solution 2. For d | n, let f(n, d) equal∑n/dk=1(dk)2 = n(n+d)(2n+d)

6d if d is square-free and 0 otherwise.Then by PIE, we have

s(n) =∑d|n

(−1)ω(d)f(n, d)

=n

6

∏p|n

(1− p) + 3n(0) + 2n2∏p|n

(1− 1

p

)=n

6

∏p|n

(1− p) +n2

3φ(n)

for n > 1 (if n = 1 the 3n term doesn’t cancel out, so we instead have s(1) = 1), where ω(m) denotesthe number of distinct prime factors of m. It follows that∑

d|n

s(d)

d2= 1 +

1

3

∑1<d|n

φ(d) +1

6

∑1<d|n

1

d

∏p|d

(1− p)

= 1 +1

3(n− φ(1)) +

1

6

−1 +∏p|n

(1 +

1− pp

+ · · ·+ 1− ppvp(n)

)= 1 +

n− 1

3+

1

6

−1 +∏p|n

1

pvp(n)

=n+ 2

3− 1

6+

1

6n

=2n2 + 3n+ 1

6n

=(n+ 1)(2n+ 1)

6n

=n

3+

1

2+

1

6n.

Since 3 | 2013, the floor of this quantity is 20133 = 671.

This problem was proposed by Ray Li. The second solution was found by a rock.

35. The rows and columns of a 7× 7 grid are each numbered 1, 2, . . . , 7. In how many ways can one choose8 cells of this grid such that for every two chosen cells X and Y , either the positive difference of theirrow numbers is at least 3, or the positive difference of their column numbers is at least 3?

Answer. 51 .

Clarifications.

• The “or” here is inclusive (as by convention, despite the “either”), i.e. X and Y are permitted ifand only if they satisfy the row condition, the column condition, or both.

January 2013 Winter OMO 2012-2013 Page 11

Solution. This bijects to the number of ways of placing 8 nonintersecting 3×3 squares in a 9×9 grid.

3-color the columns A,B,C,A, . . .. Label the 9× 9 grid with (i, j) (row i, column j). If we don’t have(i, j) ≡ (2, 2) (mod 3), we can get a lot of restrictions. Identify squares by centers. For stuff symmetric(under rotation or reflection) to (3, 3), (3, 4), (4, 3), (4, 4) we can’t have any squares (or else we kill atleast 4 A’s; for the symmetric squares we just rotate/reflect the 3-coloring as needed).

We now show that in every working configuration, at least two rows or two columns of {2, 5, 8}×{2, 5, 8}are filled out* (and these all trivially work, so it reduces to PIE). If all squares are (2, 2) (mod 3) thisis obvious. Otherwise up to rotation/reflection at least one of (2, 3), (2, 4), (5, 3), (5, 4) is used. If wehave (2, 3) or (2, 4) then we kill 3 A’s, which forces all other A’s to be used, so focusing on edges andcorners progressively we get

(5, 2) =⇒ (8, 2), (5, 5) =⇒ (8, 5) =⇒ (8, 8) =⇒ (5, 8)

so {5, 8} × {2, 5, 8} are filled out, as desired. If we have (5, 3) or (5, 4) then it’s similar; we kill 3 A’swhich forces (2, 2) =⇒ (2, 5) =⇒ (2, 8) and also (8, 2) =⇒ (8, 5) =⇒ (8, 8), so {2, 8}× {2, 5, 8} are

filled out. By PIE the answer is 2 · 3((9−2)−2

2

)= 60 minus the number of guys with all squares (2, 2)

(mod 3), so 60− 9 = 51.

*One may also draw a 3 × 3 subgrid and note that if a 3× 3 square contains part of a boundary linein its interior, say in the ith row, then if i = 1 or i = 3, the ith row of the 3× 3 subgrid intersects atmost 1 other 3 × 3 square. On the other hand, if i = 2, we can show that the first or third columnmust have such a line instead. (Why?)

This problem was proposed by Ray Li.

36. Let ABCD be a nondegenerate isosceles trapezoid with integer side lengths such that BC ‖ AD andAB = BC = CD. Given that the distance between the incenters of triangles ABD and ACD is 8!,determine the number of possible lengths of segment AD.

Answer. 337 .

Solution. Darn apparently you can bash this, and you don’t need the observation that the incentersare on the diagonals, but i think the NT part is still nice, because the bound that AB · 3 > AD makesthe counting work out perfectly.

We get 8! = AD − AB+AD−BD2 − DC+DA−AC

2 = BD − AB. Let x = AB = BC = CD and y = AD;

then BD =√x2 + xy. The requirement 3x > y eventually reduces everything to x | 8!2 = 214345272

such that x > 8!, so the answer is 15·5·3·3−12 = 337.

This problem was proposed by Ray Li.

37. Let M be a positive integer. At a party with 120 people, 30 wear red hats, 40 wear blue hats, and50 wear green hats. Before the party begins, M pairs of people are friends. (Friendship is mutual.)Suppose also that no two friends wear the same colored hat to the party.

During the party, X and Y can become friends if and only if the following two conditions hold:

a) There exists a person Z such that X and Y are both friends with Z. (The friendship(s) betweenZ,X and Z, Y could have been formed during the party.)

b) X and Y are not wearing the same colored hat.

Suppose the party lasts long enough so that all possible friendships are formed. Let M1 be the largestvalue of M such that regardless of which M pairs of people are friends before the party, there willalways be at least one pair of people X and Y with different colored hats who are not friends after theparty. Let M2 be the smallest value of M such that regardless of which M pairs of people are friendsbefore the party, every pair of people X and Y with different colored hats are friends after the party.Find M1 +M2.

January 2013 Winter OMO 2012-2013 Page 12

Answer. 4749 .

Clarifications.

• The definition of M2 should read, “Let M2 be the smallest value of M such that. . . ”. An earlierversion of the test read “largest value of M”.

Solution. View as a tripartite graph with components of size 30, 40, 50. The condition just meansthat connected components are preserved and become complete at the end (i.e. with all edges filledin).

For M = 30 + 40 + 50 − 1 we would be able to find a spanning tree of the complete tripartite graph(where every two edges are connected/people are friends). Furthermore, any connected graph on 120vertices has at least 119 edges (achieved by a tree), so M1 = 118.

On the other hand, the largest connected component (in terms of edges) not containing all vertices has(50− 1) · 40 + (50− 1) · 30 + 40 · 30 = 4630 edges, whence M2 = 4631.

Thus M1 +M2 = 4749.

This problem was proposed by Victor Wang.

38. Triangle ABC has sides AB = 25, BC = 30, and CA = 20. Let P,Q be the points on segmentsAB,AC, respectively, such that AP = 5 and AQ = 4. Suppose lines BQ and CP intersect at R andthe circumcircles of 4BPR and 4CQR intersect at a second point S 6= R. If the length of segmentSA can be expressed in the form m√

nfor positive integers m,n, where n is not divisible by the square

of any prime, find m+ n.

Answer. 166 .

Solution. Let t = 15 . Invert about A with power R2 = tAB · AC = AQ · AB = AP · AC (i.e. radius

R) and reflect about the angle bisector of ∠BAC to get C ′ = P , Q′ = B, B′ = Q, P ′ = C. Since

(ABSQ) and (ACSP ) are cyclic, S′ = B′Q′ ∩ C ′P ′ = QB ∩ PC = R. Thus AS = R2

AS′ = R2

AR . ByCeva’s theorem, R ∈ AM where M is the midpoint of BC. Yet Menelaus yields

RA

MA

MB

CB

CP

RP= 1 =⇒ AR

AM= 2

PQ

PQ+BC=

2t

t+ 1.

But it’s well-known that 4AM2 + a2 = 2(b2 + c2), so

SA =tbc

2t1+tAM

= (1 + t)bc

2AM=

6

5

(5 · 5)(5 · 4)√2(5 · 5)2 + 2(5 · 4)2 − (5 · 6)2

= 6(5)(4)√

2(5)2 + 2(4)2 − 62=

120√46,

giving us an answer of 120 + 46 = 166.

Comment. Inspired by 2009 Balkan Math Olympiad Problem 2. We can also use complex numbers(based on spiral similarity).

This problem was proposed by Victor Wang.

39. Find the number of 8-digit base-6 positive integers (a1a2a3a4a5a6a7a8)6 (with leading zeros permitted)such that (a1a2 . . . a8)6 | (ai+1ai+2 . . . ai+8)6 for i = 1, 2, . . . , 7, where indices are taken modulo 8 (soa9 = a1, a10 = a2, and so on).

Answer. 40 .

January 2013 Winter OMO 2012-2013 Page 13

Solution. Call such an integer good ; then n = (a1a2 . . . a8)6 is good if and only if

n | gcd(a1, a2, . . . , a8)(68 − 1).

(Why?) Call a good number with gcd of digits equal to 1 primitive.

Now note that 68 − 1 = (6 − 1)(6 + 1)(62 + 1)(64 + 1) and 6 − 1, 6 + 1, 62 + 1, 64 + 1 are all prime,so every positive divisor d of 68 − 1 has all ones and zeros if 6 − 1 = 5 - d and all five and zeros if

6 − 1 = 5 | d. (Prove this—think binary!) But 68−16−1 has exactly 23 = 8 positive divisors, so there are

exactly 8 primitive good numbers. Furthermore, these 8 numbers have digits all equal to 0 or 1, so wecan establish a 1-to-5 correspondence between the set of primitive good numbers and the set of goodnumbers (each primitive one corresponds to its first 5 multiples). Hence there are exactly 8 · 5 = 40good numbers.

Comment. Inspired by http://en.wikipedia.org/wiki/Cyclic_number.

This problem was proposed by Victor Wang.

40. Let ABC be a triangle with AB = 13, BC = 14, and AC = 15. Let M be the midpoint of BC andlet Γ be the circle passing through A and tangent to line BC at M . Let Γ intersect lines AB and ACat points D and E, respectively, and let N be the midpoint of DE. Suppose line MN intersects linesAB and AC at points P and O, respectively. If the ratio MN : NO : OP can be written in the forma : b : c with a, b, c positive integers satisfying gcd(a, b, c) = 1, find a+ b+ c.

Answer. 225 .

Solution. Menelaus on 4MOC and 4NOE give MPOP

OACA

CBMB = 1 and NP

OPOAEA

EDND = 1, respectively;

dividing yields MPNP = CA

EA , whence power of a point gives MPMN = CA

CE = CA2

CM2 . Similarly, MOMN = BA

BD =BA2

BM2 . It’s now easy to compute MN : NO : OP = a2 : 4c2 − a2 : 4b2 − 4c2 = 49 : 120 : 56.

This problem was proposed by James Tao.

41. While there do not exist pairwise distinct real numbers a, b, c satisfying a2+b2+c2 = ab+bc+ca, theredo exist complex numbers with that property. Let a, b, c be complex numbers such that a2 + b2 + c2 =ab+ bc+ ca and |a+ b+ c| = 21. Given that |a− b| = 2

√3, |a| = 3

√3, compute |b|2 + |c|2.

Clarifications.

• The problem should read |a+ b+ c| = 21. An earlier version of the test read |a+ b+ c| = 7; thatvalue is incorrect.

• |b|2 + |c|2 should be a positive integer, not a fraction; an earlier version of the test read “. . . forrelatively prime positive integers m and n. Find m+ n.”

Answer. 132 .

Solution. Equilateral triangle 4abc exists if and only if the center g = a+b+c3 exists. More precisely,

the condition on (a, g) is that |a| = 3√

3, |g| = 7, and |g− a| = 2√3

2 cos 30◦ = 2. By the triangle inequality,

this can happen if and only if |3√

3− 7| ≤ 2 ≤ 3√

3 + 7, which is indeed true.

Now that we’ve proven existence, note that a, b, c form the vertices of an equilateral triangle, so|a− b| = |b− c| = |c− a|, whence

3(|a|2 + |b|2 + |c|2) = |a− b|2 + |b− c|2 + |c− a|2 + |a+ b+ c|2 = 3(2√

3)2 + 212 = 477.

Thus |b|2 + |c|2 = 4773 − (3

√3)2 = 132.

Comment. A straightforward way to prove that a, b, c form the vertices of an equilateral triangle inthe complex plane is to use the quadratic formula. (Try it!) Otherwise, it’s rather difficult to discoverthe factorization (a + bω + cω2)(a + bω2 + cω) of a2 + b2 + c2 − ab − bc − ca, where ω is a primitivethird root of unity.

January 2013 Winter OMO 2012-2013 Page 14

This problem was proposed by Ray Li.

42. Find the remainder when100∏i=0

(1− i2 + i4)

is divided by 101.

Answer. 9 .

Solution. Let ω = e2πi/12 and z = e2πi/100; the key idea is that the symmetric sums of (x − g)(x −g2) · · · (x− g100) and (x− z)(x− z2) · · · (x− z100) are congruent mod 101, so the product is congruentmod 101 to the result (an integer) of

100∏j=1

(z4j − z2j + 1) =

100∏j=1

(zj − ω)(zj − ω5)(zj − ω7)(zj − ω11).

Using the factorization of x100 − 1, this boils down to

(ω100 − 1)(ω500 − 1)(ω700 − 1)(ω1100 − 1) = (ω4 − 1)2(ω8 − 1)2 = 32,

since ω4, ω8 are the two primitive 3rd roots of unity.

Solution 2. Primitive roots suffice. Let g be a primitive root modulo 101. Then, the product can bewritten in the form ∏

1≤i≤100i2 6≡−1 (mod 101)

i6 + 1

i2 + 1

Now because g100 = 1, we can show that the multisets {i6 | 1 ≤ i ≤ 100} and {i2 | 1 ≤ i ≤ 100} areequivalent modulo 101. If we delete the elements −1 (which each appear twice) from both, the sets arestill the same; in particular, their products are the same. Finally, this product is not zero. So, in ouroriginal product, almost all of the numerator and denominator cancel out except for the zeros, whichwe handle manually:

106 + 1

102 + 1· 906 + 1

902 + 1= (104 − 102 + 1)(904 − 902 + 1) ≡ 3 · 3 = 9 (mod 101).

This problem was proposed by Victor Wang. The second solution was given by Evan Chen.

43. In a tennis tournament, each competitor plays against every other competitor, and there are no draws.Call a group of four tennis players “ordered” if there is a clear winner and a clear loser (i.e., one personwho beat the other three, and one person who lost to the other three.) Find the smallest integer n forwhich any tennis tournament with n people has a group of four tennis players that is ordered.

Answer. 8 .

Solution. First note that a group of four is “ordered” iff it’s transitive iff it’s acyclic (this followsmore generally from the fact that if we contract all maximal directed cycles in a tournament, we geta transitive graph–Prove it!). The answer is 8. For n = 7, we can take the tournament described inthe last paragraph here (which also happens to be a counterexample for k = 2 here—BTW, check outHroK’s blog if you have not seen it before)—vertices are residues mod 7, and x→ {x+ 1, x+ 2, x+ 4}give us the edges. For any vertex v, its out-neighbors v + 1, v + 2, v + 4 form a triangle, which meansthere’s no transitive set of four vertices. For n = 8 there exists a vertex with at least 8−1

2 = 3.5

January 2013 Winter OMO 2012-2013 Page 15

out-neighbors and thus some v has out-degree at least 4. But every 4-tournament has at least onetransitive set of 3 vertices (else all 3-cycles), so we’re done.

Comment. As Andre Arslan notes, the construction for n = 7 is unique up to isomorphism. You haveto have two disjoint 3-cycles (take any 3-cycle out to leave four vertices, and there must be another3-cycle among them). Because the sum of all out-degrees is 21 and nothing has out-degree 4, all out-degrees are 3. Now WLOG pick a vertex in a 3-cycle and two vertices in the other 3-cycle, so thatthe first of the three picked vertices beats the other two, but loses to the vertex in the other 3-cyclenot picked. The edge relationships between the 3-cycles can now be completely determined (it’s prettyeasy to do out, there isn’t really any casework) by looking at different groups of four in the group ofsix vertices alone. The directions of edges adjacent to the seventh vertex are then easily determined aswell.

This problem was proposed by Ray Li.

44. Suppose tetrahedron PABC has volume 420 and satisfies AB = 13, BC = 14, and CA = 15. Theminimum possible surface area of PABC can be written as m+n

√k, where m,n, k are positive integers

and k is not divisible by the square of any prime. Compute m+ n+ k.

Answer. 346 .

Solution. Heron’s formula implies [ABC] =√

21(21− 13)(21− 14)(21− 15) = 84, whence the vol-ume condition gives

420 = V (PABC) =h

3[ABC] = 28h =⇒ h = 15,

where h denotes the length of the P -altitude in tetrahedron PABC.

Let Q be the projection of P onto plane ABC and let4XY Z be the pedal triangle of Q with respect to4ABC (so X is the foot from Q to BC, etc.). Now define x, y, z to be the directed lengths QX,QY,QZ,respectively, so that x > 0 when Q and A are on the same side of BC and x < 0 otherwise (likewise fory, z). Observe that the only constraint on x, y, z is ax+by+cz = 2[ABC] = 168, because if reals x, y, zsatisfy ax+ by+ cz = 168, there exists a point Q in plane ABC with x = QX, y = QY , z = QZ. As Tvaries along line BC, PT is minimized at T = X (Why?), so PX ⊥ BC and similarly, PY ⊥ CA andPZ ⊥ AB. If we define the convex function f(t) =

√t2 + h2 =

√t2 + 152 for real t, then PX = f(x),

PY = f(y), and PZ = f(z). Thus the surface area of tetrahedron PABC is just

[ABC] +af(x) + bf(y) + cf(z)

2,

which by weighted Jensen is at least

[ABC] +1

2(a+ b+ c)f

(ax+ by + cz

a+ b+ c

)= 84 + 21f(4) = 84 + 21

√241,

with equality at x = y = z = 168a+b+c = 4.

This problem was proposed by Ray Li.

45. Let N denote the number of ordered 2011-tuples of positive integers (a1, a2, . . . , a2011) with 1 ≤a1, a2, . . . , a2011 ≤ 20112 such that there exists a polynomial f of degree 4019 satisfying the followingthree properties:

• f(n) is an integer for every integer n;

• 20112 | f(i)− ai for i = 1, 2, . . . , 2011;

• 20112 | f(n+ 2011)− f(n) for every integer n.

January 2013 Winter OMO 2012-2013 Page 16

Find the remainder when N is divided by 1000.

Answer. 211 .

Solution. Throughout this proof, we will use finite differences and Newton interpolation. (See Lemma1 in the first link for a complete proof.)

Note that p = 2011 is prime. We will show more generally that when we replace 4019 by 2p − 3 and20112 by p2, there are p2p−1 such p-tuples.

Lemma. If p is a prime, the congruence (−1)kp ≡ (−1)p−1(2p−2k+p

)−(2p−2k

)(mod p2) holds for k =

0, 1, . . . , p− 1.

Proof. Expand.

Corollary. The 2p − 2th finite differences of the p-periodic sequence b = (b0, b1, b2, . . .) all vanish ifand only if p | b1 + b2 + · · ·+ bp.

Proof. By the lemma,

∆2p−2[b]j =

2p−2∑i=0

(−1)i(

2p− 2

i

)bj+i ≡ −p

p−1∑i=0

bj+i (mod p2)

for fixed j ≥ 0.

Extend the indices of the ai modulo p so that ai = ai (mod p) for all integers i. Since f(x) satisfiesthe three properties if and only if f(x) + p2x2p−3 does, we just have to find the number of p-tuplesinterpolated by a polynomial of degree at most 2p− 3. By Newton interpolation, this is possible if andonly if the 2p − 2th finite differences of the infinite (periodic) sequence a = (a0, a1, a2, . . .) all vanishmodulo p2. By the Lemma, this occurs when and only when p | a1 + a2 + · · ·+ ap, so the answer is

1

p(p2)p = p2p−1 = 20114021 ≡ 1121 ≡ 1 +

(21

1

)10 +

(21

2

)102 ≡ 211 (mod 1000).

Solution 2. A more conceptual solution can be found by relating (x−1)d+1(a0+a1x+ · · ·+ap−1xp−1)modulo p2, xp − 1 to the “interpolating polynomials” of the p-tuple (a1, a2, . . . , ap). If (x − 1)2p−2 ≡m(1 + x+ · · ·+ xp−1) in this modulus, it’s not hard to prove vp(m) = 1.

The idea is that 4020 is the smallest integer such that (x − 1)4020+1 vanishes mod 20112, x2011 − 1,so you note that the interpolating polynomials of degree 4020 for (1, 0, . . . , 0), (0, 1, . . . , 0), etc., sayG1, G2, . . . , Gp (2011 places for the 1, all else 0) all have the same “Newton interpolation leadingcoefficient” (i.e. the coefficient of

(x

4020

), or the 4020th finite difference), with 2011-adic valuation

exactly 1. Indeed, for (p, 0, . . . , 0), the least interpolating degree is lower than the maximum of 4020(by induction, considering the mod p, xp−1 problem instead of mod p2, xp−1), so this gives us vp = 1,and of course, the 4020th finite differences of Gi all have to be equal since 4021th vanish always. Sowe have degree 4020 exactly when 2011 - a1 + · · ·+ a2011, so the answer is (1− 1/p)(p2)p.

Comment. See this thread and its resolution on MathOverflow for the original context of this problem.

The author conjectures that∑jk=0(−1)kp

i(pi+(j−1)φ(pi)−1kpi

)≡ (−p)j−1 (mod pj), which for j = 2 is

stronger than the vp = 1 condition mentioned in the second solution (it gives the exact value mod p2).For higher j the reader can check this is stronger than the corresponding vp = j − 1.

This problem was proposed by Victor Wang.

January 2013 Winter OMO 2012-2013 Page 17

46. Let ABC be a triangle with ∠B − ∠C = 30◦. Let D be the point where the A-excircle touches lineBC, O the circumcenter of triangle ABC, and X,Y the intersections of the altitude from A with theincircle with X in between A and Y . Suppose points A, O and D are collinear. If the ratio AO

AX can be

expressed in the form a+b√c

d for positive integers a, b, c, d with gcd(a, b, d) = 1 and c not divisible bythe square of any prime, find a+ b+ c+ d.

Answer. 11 .

Solution. The angle condition is equivalent to ∠ADB = 60◦. Let H be the orthocenter, I the incenter,and E the tangency point of BC and the incircle (I); reflect E over E′ to get I. By the well-knownhomothety about A taking (I) to the A-excircle, we see that A,E′, D are collinear. Thus AE′OD is theA-isogonal of AXHY , so AE′ = AE. Since E′IE ⊥ BC ⊥ AXHY and ∠DAH = 30◦, ∠AE′I = 150◦

and since IX = IE′, 4AXI ∼= 4AE′I, whence ∠AXI = 150◦ and thus AXIE′ is a rhombus. Nownote that OE = OD, so O is the midpoint of E′D in right triangle 4E′ED. But I is the midpoint ofE′E, so ∠OIE′ = 90◦ and it follows that

AO

AX=

AO

AE′= 1 +

OE′

IE′= 1 +

1

sin 60◦=

3 + 2√

3

3.

Solution 2. Let AD meet the incircle ω at X ′, and recall that X ′I is a diameter of ω. Let theinradius be r and the circumradius R. Note that since ∠BAY = ∠DAC = 90−B, we can derive that∠XAX ′ = 30◦ and AX = AX ′.

Then, note also that O is the midpoint of X ′D. Using the angle information, we find that IO = r√3.

Observe OA = OB = R.

Assume WLOG that r =√

3. Now, set I = (−1, 0), O = (0, 0), A =(−R2 ,

√3R2

)and B =(

−√R2 − 3,−

√3). We need AB to be tangent to ω; that is, the distance from I to AB is r =

√3. A

few pages of calculation yield the quartic R4 − 11R2 − 12R + 4 = 0, which has a double root at −2and gives (R+ 2)2(R2 − 4R+ 1) = 0, which gives R =

√3 + 2 as the only valid solution.

Then, AOAX′ = R

R− 2√3r

= 2+√3√

3= 2√3+33 .

Solution 3. (Sketch) It’s possible to find a trigonometric solution with only the synthetic observation

AE = AE′. Indeed, we can use the homothety relation AE′

AD = rra

= s−as and the law of sines on

4ADC to get everything in terms of trigonometric functions involving C. Using the sine and cosineaddition and subtraction formulas a few times, we can get an equation in terms of cos 2x and cosx,where x = C + 15◦ = 90◦ − A

2 .

This problem was proposed by James Tao. The second solution was provided by Evan Chen. Thethird solution was provided by Victor Wang.

47. Let f(x, y) be a function from ordered pairs of positive integers to real numbers such that

f(1, x) = f(x, 1) =1

xand f(x+ 1, y + 1)f(x, y)− f(x, y + 1)f(x+ 1, y) = 1

for all ordered pairs of positive integers (x, y). If f(100, 100) = mn for two relatively prime positive

integers m,n, compute m+ n.

Answer. 111088900001 .

January 2013 Winter OMO 2012-2013 Page 18

Solution. We can easily prove by induction that

f(x, y) =1 + 4

(x+13

)(y+13

)xy

for all positive integers x, y. It quickly follows that f(100, 100) = 1+111100·99990010000 .

Comment. Perhaps the most natural way to find the pattern is to find f for small fixed values of y(say 0 through 3). When searching for the pattern, it is helpful to substitute g(x, y) = xyf(x, y).

This problem was proposed by David Yang.

48. ω is a complex number such that ω2013 = 1 and ωm 6= 1 for m = 1, 2, . . . , 2012. Find the number ofordered pairs of integers (a, b) with 1 ≤ a, b ≤ 2013 such that

(1 + ω + · · ·+ ωa)(1 + ω + · · ·+ ωb)

3

is the root of some polynomial with integer coefficients and leading coefficient 1. (Such complexnumbers are called algebraic integers.)

Answer. 4029 .

Solution. We will repeatedly use the fact that the set AI of algebraic integers is closed under additionand multiplication (in other words, AI is a ring). First, however, we show that

(1 + ω + · · ·+ ωa)(1 + ω + · · ·+ ωb)

3

must in fact be an algebraic integer for every primitive 2013th root (if it is for at least one)1. Actually,we can prove a much more general statement.

Lemma 1. Let z be an algebraic number with minimal polynomial f ∈ Q[x] of degree n ≥ 1 (so thatf is monic). Suppose f has roots z1 = z, z2, . . . , zn (these are the conjugates of z). If there exists apolynomial g ∈ Q[x] for which g(z) ∈ AI, then g(zi) ∈ AI for i = 1, 2, . . . , n.

Proof. Let h ∈ Q[x] be the minimal polynomial of g(z); then h (which is monic) has integer coefficientssince g(z) ∈ AI. Since h(g(x)) has rational coefficients and h(g(z)) = 0, the minimal polynomial f(x)of z must divide h(g(x)). But then h(g(zi)) = 0 for all i (the zi are the roots of f by definition), sog(zi) ∈ AI for all i (the roots of h(x) are all algebraic integers by definition).

For a slightly different (but really equivalent) perspective, consider the map fi : Q(z) → Q(zi) thatfixes the rationals, is multiplicative and additive, and maps z to zi; then fi is a ring isomorphism(because z and zi have the same minimal polynomial). In particular, since fi fixes the coefficients ofg and h, we have

0 = fi(0) = fi(h(g(z))) = h(g(fi(z))) = h(g(zi)) = 0,

whence zi is also a root of h(g(x)).

See the second post here for a more “concrete” application of these ideas.

Lemma 2. The nth cyclotomic polynomial Φn(x) evaluated at 1 gives 0 for n = 1, p for n = pk aprime power, and 1 otherwise.

1For contest purposes, this can actually just be deduced by meta-analysis of the problem statement.

January 2013 Winter OMO 2012-2013 Page 19

Proof. From∏d|n Φd(x) = xn − 1, we get

∏1<d|n Φd(x) = 1 + x + · · · + xn−1. The rest follows by

induction on n. (While this is not strictly necessary, observe that for n > 1, Φn(1) 6= 0 since 1 is nota primitive nth root of unity.)

Corollary. If n has at least two distinct prime factors, 1 − ζ is an “invertible” algebraic integer forany primitive nth root of unity ζ.

Proof. First suppose n has at least two distinct prime factors. Clearly 1− ζ is an algebraic integer. Onthe other hand, Lemma 2 gives us Φn(x) = (x− 1)f(x) + 1 for some polynomial f ∈ Z[x], so pluggingin x = ζ gives (1− ζ)−1 = f(ζ), which is indeed an algebraic integer (as f has integer coefficients).

The corollary tells us that for a fixed 2013th primitive root of unity ω,

(1 + ω + · · ·+ ωa)(1 + ω + · · ·+ ωb)

3∈ AI

if and only if (1−ωa+1)(1−ωb+1)3 ∈ AI is too. From now on we work with this simpler form.

If 2013 | a + 1 or 2013 | b + 1, the expression vanishes and is trivially an algebraic integer, so nowsuppose 2013 - a+ 1 and 2013 - b+ 1. Multiplying the new expression over all 2013th primitive rootsof unity shows that

3−φ(2013)∏

0<k<2013gcd(k,2013)=1

(1− e2πk(a+1)i/2013)(1− e2πk(b+1)i/2013)

must be both a rational number (Why?) and an algebraic integer, and thus a “rational” integer by therational root theorem (*). On the other hand,∏

0<k<2013gcd(k,2013)=1

(1− e2πk(a+1)i/2013) = (Φc(1))φ(2013)/φ(c),

where c = 2013/ gcd(2013, a + 1) > 1 by our assumption 2013 - a + 1 (similarly define d > 1 in termsof b). However, since 2013 is square-free, and φ(c), φ(d) ≥ 2 (since c, d > 1 and c, d | 2013), Lemma 2forces c = d = 3, or else we contradict (*) (as we fail to cancel out the factors of 3 earlier).

To prove that the expression is an algebraic integer whenever c = d = 3, we note the identities(1−ζ)2

3 = −ζ and (1−ζ)(1−ζ2)3 = 1 (which are both algebraic integers) for primitive 3rd roots of unity

ζ. More generally, this follows from the fact that 1−ζ√3

is an algebraic integer (in fact, an invertible

algebraic integer).

Thus (a, b) works if and only if 2013 | a + 1, 2013 | b + 1, or (a + 1, b + 1) ∈ {2013/3, 2 · 2013/3}2, sothe desired total is (20132 − 20122) + 22 = 4029.

Comment. The interested reader may want to further investigate the “Corollary” stated above forn = pk a prime power. For instance, (1− ζ)−1 is not an algebraic integer, but p(1− ζ)−1 is. (Why?)How about p−1(1− ζ)? (It may help to think about the p = 3 case introduced in this problem.)

This problem was proposed by Victor Wang.

49. In 4ABC, CA = 1960√

2, CB = 6720, and ∠C = 45◦. Let K, L, M lie on BC, CA, and AB such thatAK ⊥ BC, BL ⊥ CA, and AM = BM . Let N , O, P lie on KL, BA, and BL such that AN = KN ,BO = CO, and A lies on line NP . If H is the orthocenter of 4MOP , compute HK2.

Clarifications.

• Without further qualification, “XY ” denotes line XY .

January 2013 Winter OMO 2012-2013 Page 20

Answer. 68737600 .

Solution. Let a = BC, b = CA, c = AB, and compute c = 3640√

2. Let M ′ be the midpoint of ACand let O′ be the circumcenter of 4ABC.

It is well known that KMLM ′ is cyclic, as is AMO′M ′. Also, ∠BO′A = 2∠C = 90◦, so O′ lies onthe circle with diameter AB. Then N is the radical center of these three circles; hence A,N,O′ arecollinear.

Now applying Brokard’s Theorem to the circle with diameter AB, we find that M is the orthocenterof the OPH ′, where H ′ = LA ∩ BO′. Hence H ′ is the orthocenter of 4MOP , whence H = H ′ =AC ∩BO′.Then, it is well known2 that

AH

HC=c2(a2 + b2 − c2)

a2(b2 + c2 − a2)

where the lengths are directed. Cancelling a factor of 2802 we can compute:

AH

HC=c2(a2 + b2 − c2)

a2(b2 + c2 − a2)

=338(576 + 98− 338)

576(98 + 338− 576)

= −169

120.

Therefore,

AC

HC= 1 +

AH

HC

= − 49

120

=⇒ |HC| = 120

49· 1960

√2

= 4800√

2.

Now applying the Law of Cosines to 4KCH with ∠KCH = 135◦ yields

HK2 = KC2 + CH2 − 2KC · CH · cos 135◦

= 19602 +(

4800√

2)2− 2(1960)

(4800√

2)(− 1√

2

)= 402

(492 + 2 · 1202 + 2 · 49 · 120

)= 1600 · 42961

= 68737600 .

Solution 2. We use the following more general formulation:

2One can prove this just using the identity BPPC

= b sin∠PABc sin∠CAP

and substituting the law of cosines in.

January 2013 Winter OMO 2012-2013 Page 21

Work in the projective plane for convenience and consider any triangle ABC. Let K,L bethe feet of the altitudes from A,B respectively, and let T = AK ∩ BL be the orthocenterof 4ABC. Let P be the intersection of line BLT and the tangent AA to (ATB) (this linecontains N in the original problem, so the definition of P is still the same regardless of angleC), and let O be the point on line AB satisfying LO ⊥ BC (the new definition of O is thekey change). If M is the midpoint of AB, compute HK2.

Let Q = LO ∩BC be the foot from L to BC. We want to relate P to O,M somehow; define S to bethe intersection of lines PA(N) and LOQ. Since lines LOQS, TAK are parallel and PA is tangent to(ATB),

]LSA = ]TAP = ]TBA = ]LBA,

so L,A,K, S,B all lie on the circle ω with diameter AB. By Brokard’s theorem, P = AS ∩ BL,O = AB ∩ LS, X = AL ∩ BS form a self-polar triangle, so M , the center of ω, is the orthocenter of4XOP . But then X must be the orthocenter of 4MOP , so in fact X = H. Now proceed as above.For a directed-friendly finish, use the law of sines on 4HBC to get HB and HC in terms of BC and∠BHC, and then use the directed version of Stewart’s theorem to get HK.

This problem was proposed by Evan Chen. The second solution was provided by Victor Wang.

50. Let S denote the set of words W = w1w2 . . . wn of any length n ≥ 0 (including the empty stringλ), with each letter wi from the set {x, y, z}. Call two words U, V similar if we can insert a strings ∈ {xyz, yzx, zxy} of three consecutive letters somewhere in U (possibly at one of the ends) to obtainV or somewhere in V (again, possibly at one of the ends) to obtain U , and say a word W is trivialif for some nonnegative integer m, there exists a sequence W0,W1, . . . ,Wm such that W0 = λ is theempty string, Wm = W , and Wi,Wi+1 are similar for i = 0, 1, . . . ,m− 1. Given that for two relativelyprime positive integers p, q we have

p

q=∑n≥0

f(n)

(225

8192

)n,

where f(n) denotes the number of trivial words in S of length 3n (in particular, f(0) = 1), find p+ q.

Answer. 61 .

Solution. First we make some helpful definitions.

For convenience, call xyz, yzx, zxy the three cyclic words. Let λ be the empty string. Say the wordW is reduced unless and only unless at least one of the three cyclic words appears as a string of threeconsecutive letters in W . (In particular, λ is reduced.) Let S∗ ⊆ S be the set of reduced words.

Define ∼ so that U ∼ V if and only if U, V are similar. Call two words U, V equivalent if thereexists a finite sequence of words W0,W1, . . . ,Wm such that U = W0, V = Wm, and Wi ∼ Wi+1 fori = 0, 1, . . . ,m−1. Define the binary relation ≡ so that U ≡ V if and only if U, V are equivalent. Then≡ is clearly reflexive, symmetric, and transitive, and W is trivial if and only if W ≡ λ. Furthermore,if A ≡ C and B ≡ D, then AB ≡ CD.

The distinction between = and ≡ will be important throughout the proof. We have U = V if and onlyif U, V are identical when parsed as sequences of letters, i.e. they’re composed of the same letters inthe same order (and in particular, have the same length).

Let T be the set of trivial words and T0 ⊆ T be the set of minimal trivial words, i.e. words W =w1w2 . . . wn ∈ T such that w1w2 . . . wi /∈ T for i = 1, 2, . . . , n − 1 (we vacuously have λ ∈ T0). It’seasy to see that every trivial word W can be uniquely expressed in the form W1W2 . . .Wm for somenonnegative integer m and nonempty W1,W2, . . . ,Wm ∈ T0. (*) Indeed, this follows from the simplefact that B ≡ λ if AB,A ∈ T .

January 2013 Winter OMO 2012-2013 Page 22

Lemma 1. No two distinct reduced words are equivalent.

Proof. Define a “canonical” reduced form R(W ) for each word W ∈ S by always deleting the leftmostcyclic word in W until it’s no longer possible (so zxyxyzz becomes xyzz and then z).

We will now show that R(A) = R(B) whenever A ∼ B. WLOG suppose that A = PQ and B = PxyzQfor two words P,Q (possibly empty). Since R(A) = R(R(P )Q) and R(B) = R(R(P )xyzQ), we canWLOG suppose that P ∈ S∗. If xyz is the leftmost cyclic word in B, then R(PxyzQ) = R(PQ).Otherwise, P ends in z. If P = P ′yz for some P ′ ∈ S (since P ∈ S∗, P ′ doesn’t end in x), then yzxis the leftmost cyclic word in B and R(PxyzQ) = R(P ′(yzx)yzQ) = R(P ′yzQ) = R(PQ). Finally,if P = P ′z for some P ′ ∈ S but P ′ doesn’t end in y, then zxy is the leftmost cyclic word in B andR(PxyzQ) = R(P ′(zxy)zQ) = R(P ′zQ) = R(PQ), completing the proof that R(A) = R(B).

We can directly extend this to find that R(A) = R(B) whenever A ≡ B. But then R(A) 6= R(B)implies A 6≡ B for any two distinct reduced words A,B.

Comment. This is loosely modeled off of the proof in Lemma 1 here that the free group is nontrivial.

Corollary. R(W ) is the unique reduced word W ∗ ∈ S∗ equivalent to W . In particular, W is trivial ifand only if R(W ) = λ (so 3 | |W | for all W ∈ T ).

Proof. If not, then there are two distinct reduced words equivalent to W , contradicting the lemma.

We are now prepared to prove the key lemma. Define the function t : {x, y, z} → {x, y, z} so thatt(x) = y, t(y) = z, t(z) = x.

Lemma 2. Let n be a positive integer. Then the word W = w1w2 . . . wn lies in T0 if and only if thereexists a sequence of nonempty words A1, A2, . . . , Am ∈ T0 (m ≥ 0) and index p ∈ {0, 1, . . . ,m} suchthat

W = w1A1A2 . . . Apt(w1)Ap+1Ap+2 . . . Amt2(w1),

none of A1, A2, . . . , Ap end with w1, and none of Ap+1, Ap+2, . . . , Am start with t2(w1). Furthermore,this representation is unique for any fixed W ∈ T0.

Proof. Call the representation a standard presentation of W if it exists.

We proceed by strong induction on n ≥ 1. For the base case, note that by the Corollary (to Lemma1)3, the only nonempty trivial words of length at most three are the three cyclic words, which are alsominimal. This proves the claim for n ≤ 3.

Now suppose n ≥ 4 and assume the inductive hypothesis for 1, 2, . . . , n − 1. We will first show thatevery minimal trivial word W has a standard presentation. Of course, the Corollary implies 3 | n.By the minimality of W and the Corollary (consider the possible sequences of reductions taking W toR(W ) = λ), there exists an index q ∈ {1, 2, . . . , n} such that

w1wqwn ≡ w2w3 . . . wq−1 ≡ wq+1wq+2 . . . wn−1 ≡ λ.

(Why?) Then wq = t(w1), wn = t2(w1), and by (*), there exists a (unique) sequence of nonemptywords A1, A2, . . . , Am ∈ T0 (m ≥ 0) and index p ∈ [0,m] such that w2 . . . wq−1 = A1 . . . Ap andwq+1 . . . wn−1 = Ap+1 . . . Am. If for some i ∈ [p+ 1,m], Ai ends with t2(w1), then

w1A1 . . . Apt(w1)Ap+1 . . . Ai−1t2(w1) ≡ λ,

3Lemma 1, while only explicitly used once, is the cornerstone of the base case, without which the induction would crumble.In particular, it shows that xzy, yxz, zyx /∈ T .

January 2013 Winter OMO 2012-2013 Page 23

contradicting the minimality of W . Similarly, if Ai ends with w1 for some i ∈ [1, p], then

w1Ai+1 . . . Apt(w1)Ap+1 . . . Amt2(w1) ≡ λ,

once again contradicting the minimality of W (this time, however, we use the fact that W is minimalif and only if wi . . . wn 6≡ λ for i ∈ [1, n], which follows, for instance, from (*)).

The previous paragraph establishes the existence of a standard presentation for W ∈ T0. Now assumefor contradiction that there exists another such representation

w1A′1A′2 . . . A

′p′t(w1)A′p′+1A

′p′+2 . . . A

′m′t

2(w1),

with the t(w1) in the middle indexed at wq′ (the t2(w1) at the end is, of course, wn). By (*), q′ cannotequal q, so WLOG q′ > q. We must then have A′i = Ai for i = 1, 2, . . . , p, whence A′p+1 starts witht(w1) and by the inductive hypothesis, ends with t2(t(w1)) = w1. Yet this contradicts the validity ofA′p+1, so the standard presentation of W must in fact be unique.

Finally, we show that if W has a standard presentation, then it must lie in T0. Since w1t(w1)t2(w1) ≡Ai ≡ λ for i = 1, 2, . . . ,m, W is obviously trivial; it remains to show that W is minimal. Go bycontradiction and suppose there exists n′ ∈ [1, n) such that W ′ = w1w2 . . . wn′ ∈ T0; by the inductivehypothesis, W ′ has a (unique) standard presentation

w1A′1A′2 . . . A

′p′t(w1)A′p′+1A

′p′+2 . . . A

′m′t

2(w1).

As in the previous paragraph, if q′ denotes the index of t(w1) in W , then we must have q′ = q (otherwiseone of A′1, . . . , A

′p′ , A1, . . . , Ap starts with t(w1) and so ends with w1). Therefore m′ < m and A′i = Ai

for i ∈ [p′ + 1 = p+ 1,m′], whence t2(w1) will appear at the start of Am′+1, contradiction.

In view of Lemma 2, let g(n) be the number of minimal trivial words of length 3n (n > 0). Theng(1) = 3 and considering standard presentations, we get

g(n)

3=

∑a1+···+am=n−1m,a1,...,am≥1

(m+ 1)

m∏i=1

2

3g(ai)

for4 n ≥ 2 (in the notation of Lemma 2, there are m + 1 choices for p, and 23g(|Ai|) choices for each

Ai, regardless of whether i ≤ p or i ≥ p+ 1). Summing over n ≥ 2 yields

G(u)

3=g(1)u

3+ u

∑m≥1

(m+ 1)

(2

3G(u)

)m= u

∑m≥0

(m+ 1)

(2

3G(u)

)m=

u

(1− 2G(u)/3)2,

where G(u) =∑n≥1 g(n)un. By (*), F (u) =

∑n≥0 f(n)un = 1

1−G(u) .

Before evaluating the generating functions F,G at u = 225/8192, observe that 0 ≤ g(n) ≤ f(n) ≤ 33n

for every nonnegative integer n, so

0 < G(225/8192) ≤ F (225/8192) ≤∑n≥0

(33

225

8192

)n4Actually, the recurrence is true for n = 1 “by convention,” i.e. if we allow m = 0 and interpret empty products as 1. This

simplifies the calculation of G(u) slightly.

January 2013 Winter OMO 2012-2013 Page 24

converges (as 33·225 = 6075 < 8192). ThusG(u), F (u) are positive reals satisfyingG(u) = 1−F (u)−1 <1.

Finally, letting v = G(u)/3, we get

152

213=

225

8192= v(1− 2v)2 =⇒ 152 = w(16− w)2,

where w = 25v. Solving this cubic yields w ∈ {1, 12 (31±√

61)}. But 332w = G(u) < 1 =⇒ w < 32

3 <

11 < 12 (31±

√61), forcing w = 1 =⇒ G(u) = 3

32 . Therefore F (u) = 11−G(u) = 1

1−3/32 = 3229 .

Solution 2. Map every word by adding the position of the word to itself mod 3, so we can considerinserting/deleting xxx, yyy, or zzz instead.

Now consider each word as a sequence of instructions acting on a stack, where x is an instruction thatsays “if the top two elements of the stack are both x, pop both of them; otherwise push x”. We claimthe set of trivial words is the set of programs that, when run on an empty stack, result in anotherempty stack.

The three sequences xxx, yyy, zzz are always no-ops (they just cycle the number of some elementdirectly on top of the stack mod 3), so clearly inserting or deleting them will preserve the effects of aprogram. Furthermore, any effectless program can be obtained by insertions alone: just look at the 2operations before and 1 after any moment when the stack has the most elements, and induct on length.

Then we can note three important parts in each trivial nonempty program P : (I) after the first symbol,say w is pushed; (II) after the second copy of that symbol w is pushed; (III) after ww is popped.

The part after (III) can be any other trivial program. The parts between (I) and (II), and between(II) and (III), must each be trivial programs where w is never pushed as the bottom of the stack. Let’scall these “w-bottomless” programs (all the good names have been taken :( ).

w-bottomless programs can be divided into three parts in the same way. Then we discover the necessaryparts in each part are also something-bottomless programs. That is, you can get an x-bottomlessprogram, say, by picking which of y or z to push (WLOG y), which y-bottomless program to put inpart (I), which y-bottomless program to put in part (II), and which x-bottomless program to put inpart (III). So there’s a simple generating function equation:

B(x) = 1 + 2xB(x)3.

You can actually count the number of w-bottomless programs directly. Factor out the power of 2that results from each choice of symbol, so the difference sequence of the stack heights/sizes is asequence of +1s and −2s that sum to 0 with no negative partial sums. Then insert a +1 at the startto convert the condition to “no nonnegative partial sums”, cyclically permute the steps, and observethat exactly one cyclic permutation of these steps has no nonnegative partial sums, so we get a totalof 2n 1

3n+1

(3n+1n

)= 2n

n

(3nn−1)

where n is the number of −2s, or equivalently, 3n is the number of stepsin the w-bottomless program. To recover the stack sequence/bottomless program from the sequenceof +1s and −2s, consider the first −2, which must have two +1s before it, and remove these threenumbers. These three correspond to a “pop”, and because they have zero sum, we can repeatedlytake out +1,+1,−2 subsequences, each corresponding to a “layer” in the program. Order the layers asfollow: the layer corresponding to the first +1 is the “first”; after that, the first +1 we encounter thatis not in the first layer and its two partners belong to the “second layer”, and so on. For convenience,define a “phantom zeroth layer” www. Then when we evaluate the program (including pops, etc.), thefirst +1 of the ith layer, i > 0 will be directly “above” a +1 (either the first or second) of the jth layerfor some 0 ≤ j < i, and thus must have a different symbol. (For j = 0, it just means we’ve reachedthe bottom again, so the ith layer can’t have symbol w by the w-bottomless restriction). In particular,

January 2013 Winter OMO 2012-2013 Page 25

the first layer cannot start with w.) Thus we have 2n ways to assign symbols to the sequence of +1sand −2s, one power of 2 for each layer.

Then for the original sequence’s generating function, again: there are 3 ways to choose which symbolis first pushed, and you have to choose two something-bottomless programs for (I) and (II) and onetrivial program for (III), so:

F (x) = 1 + 3xB(x)2F (x)

Then just plug in x and solve the two equations for B(x) and F (x). (Presumably there are extraneoussolutions, but I just assumed the one that looked nice was right. :P)

Comment. The key here is to recognize that this is sort of similar to Catalan parentheses recurrence(with the notion of minimal words). In fact if we replace {xyz, yzx, zxy} with {xy}, then the problemis equivalent to Catalan. However, the primary motivation for this problem is the one posted here,with x+ y+ y−1x−1 instead of x+ y+x−1 + y−1. Also, it is possible to get a nice closed form for g(n)using the Lagrange inversion theorem: we can get

g(n) =3 · 2n−1

3n− 1

(3n− 1

n

),

which checks out with the computations above using WolframAlpha.

However, in order to generalize this to four or more letters in the natural way (so {xyzw, yzwx, . . .} forfour letters), we need to slightly modify Lemma 2. The key ideas are the same, however, so we leavethe rest to the interested reader. (It may be helpful to use the fact that if UV ≡ λ, then V U ≡ λ.Basic group theory, particularly the notion of inverses, may make this slightly easier to see.)

This problem was proposed by Victor Wang. The second solution was given by Brian Chen, with aclose variant posted by Team SA on AoPS.