返回题库

AIME 1985 · 第 12 题

AIME 1985 — Problem 12

专题
Contest Math
难度
L4
来源
AIME

题目详情

Problem

Let AA, BB, CC and DD be the vertices of a regular tetrahedron, each of whose edges measures 11 meter. A bug, starting from vertex AA, observes the following rule: at each vertex it chooses one of the three edges meeting at that vertex, each edge being equally likely to be chosen, and crawls along that edge to the vertex at its opposite end. Let p=n729p = \frac{n}{729} be the probability that the bug is at vertex AA when it has crawled exactly 77 meters. Find the value of nn.

解析

Solution 1 (Single Variable Recursion)

For all nonnegative integers k,k, let P(k)P(k) be the probability that the bug is at vertex AA when it has crawled exactly kk meters. We wish to find p=P(7).p=P(7).

Clearly, we have P(0)=1.P(0)=1. For all k1,k\geq1, note that after k1k-1 crawls:

  1. The probability that the bug is at vertex AA is P(k1),P(k-1), and the probability that it crawls to vertex AA on the next move is 0.0.

  2. The probability that the bug is not at vertex AA is 1P(k1),1-P(k-1), and the probability that it crawls to vertex AA on the next move is 13.\frac13.

Together, the recursive formula for P(k)P(k) is

P(k)={1if k=013(1P(k1))if k1.P(k) = \begin{cases} 1 & \mathrm{if} \ k=0 \\ \frac13(1-P(k-1)) & \mathrm{if} \ k\geq1 \end{cases}. Two solutions follow from here:

Solution 1.1 (Recursive Formula)

We evaluate P(7)P(7) recursively:

P(0)=1,P(1)=13(1P(0))=0,P(2)=13(1P(1))=13,P(3)=13(1P(2))=29,P(4)=13(1P(3))=727,P(5)=13(1P(4))=2081,P(6)=13(1P(5))=61243,P(7)=13(1P(6))=182729.\begin{alignat*}{6} P(0)&=1, \\ P(1)&=\frac13(1-P(0))&&=0, \\ P(2)&=\frac13(1-P(1))&&=\frac13, \\ P(3)&=\frac13(1-P(2))&&=\frac29, \\ P(4)&=\frac13(1-P(3))&&=\frac{7}{27}, \\ P(5)&=\frac13(1-P(4))&&=\frac{20}{81}, \\ P(6)&=\frac13(1-P(5))&&=\frac{61}{243},\\ P(7)&=\frac13(1-P(6))&&=\frac{182}{729}. \end{alignat*} Therefore, the answer is n=182.n=\boxed{182}.

~Azjps ~MRENTHUSIASM

Solution 1.2 (Explicit Formula)

Let P(k)=Q(k)+cP(k)=Q(k)+c for some function Q(k)Q(k) and constant c.c. For all k1,k\geq1, the recursive formula for P(k)P(k) becomes

Q(k)+c=13(1(Q(k1)+c))=1313Q(k1)13c.Q(k)+c=\frac13(1-(Q(k-1)+c))=\frac13-\frac13Q(k-1)-\frac13c. Solving for Q(k),Q(k), we get

Q(k)=1313Q(k1)43c.Q(k)=\frac13-\frac13Q(k-1)-\frac43c. For simplicity purposes, we set c=14,c=\frac14, which gives

Q(k)=13Q(k1).Q(k)=-\frac13Q(k-1). Clearly, Q(0),Q(1),Q(2),Q(0),Q(1),Q(2),\ldots is a geometric sequence with the common ratio Q(k)Q(k1)=13.\frac{Q(k)}{Q(k-1)}=-\frac13. Substituting P(0)=1P(0)=1 and c=14c=\frac14 into P(0)=Q(0)+cP(0)=Q(0)+c produces Q(0)=34,Q(0)=\frac34, the first term of the geometric sequence.

For all nonnegative integers k,k, the explicit formula for Q(k)Q(k) is

Q(k)=34(13)k,Q(k)=\frac34\left(-\frac13\right)^k, and the explicit formula for P(k)P(k) is

P(k)=34(13)k+14.P(k)=\frac34\left(-\frac13\right)^k+\frac14. Finally, the requested probability is p=P(7)=182729,p=P(7)=\frac{182}{729}, from which n=182.n=\boxed{182}.

~MRENTHUSIASM

Solution 2 (Multivariable Recursion by Algebra)

Denominator

There are 373^7 ways for the bug to make 77 independent crawls without restrictions.

Numerator

Let VkV_k denote the number of ways for the bug to crawl exactly kk meters starting from vertex VV and ending at vertex A,A, where V{A,B,C,D}V\in\{A,B,C,D\} and kk is a positive integer. We wish to find A7.A_7.

Since the bug must crawl to vertex B,C,B,C, or DD on the first move, we have

A7=B6+C6+D6=(A5+C5+D5)+(A5+B5+D5)+(A5+B5+C5)=A5+2(A5+B5+C5+D5)=A5+2S5,\begin{aligned} A_7&=B_6+C_6+D_6 \\ &=(A_5+C_5+D_5)+(A_5+B_5+D_5)+(A_5+B_5+C_5) \\ &=A_5+2(A_5+B_5+C_5+D_5) \\ &=A_5+2S_5, \end{aligned} where Sk=Ak+Bk+Ck+Dk.S_k=A_k+B_k+C_k+D_k.

More generally, we get

Ak+2=Ak+2Sk.()A_{k+2}=A_k+2S_k. \qquad\qquad (\spadesuit) For Sk,S_k, note that

  1. Base Case:

S1=A1+B1+C1+D1=0+1+1+1=3.\begin{aligned} S_1&=A_1+B_1+C_1+D_1 \\ &=0+1+1+1 \\ &=3. \end{aligned} 2. Recursive Case:

Sk+1=Ak+1+Bk+1+Ck+1+Dk+1=(Bk+Ck+Dk)+(Ak+Ck+Dk)+(Ak+Bk+Dk)+(Ak+Bk+Ck)=3(Ak+Bk+Ck+Dk)=3Sk.\begin{aligned} S_{k+1}&=A_{k+1}+B_{k+1}+C_{k+1}+D_{k+1} \\ &=(B_k+C_k+D_k)+(A_k+C_k+D_k)+(A_k+B_k+D_k)+(A_k+B_k+C_k) \\ &=3(A_k+B_k+C_k+D_k) \\ &=3S_k. \end{aligned} Clearly, S1,S2,S3,S_1,S_2,S_3,\ldots is a geometric sequence with the first term S1=3S_1=3 and the common ratio Sk+1Sk=3.\frac{S_{k+1}}{S_k}=3. Therefore, its explicit formula is

Sk=3k.()S_k=3^k. \qquad\qquad (\clubsuit) Recall that A1=0.A_1=0. By ()(\spadesuit) and (),(\clubsuit), we rewrite A7A_7 recursively:

A7=A5+2S5=(A3+2S3)+2S5=((A1+2S1)+2S3)+2S5=2S1+2S3+2S5=2(3)+2(33)+2(35).\begin{aligned} A_7 &= A_5+2S_5 \\ &=\left(A_3+2S_3\right)+2S_5 \\ &=\left(\left(A_1+2S_1\right)+2S_3\right)+2S_5 \\ &=2S_1+2S_3+2S_5 \\ &=2(3)+2\left(3^3\right)+2\left(3^5\right). \end{aligned} Answer

The requested probability is

p=A737=2(3)+2(33)+2(35)37=2(1)+2(32)+2(34)36=182729,p=\frac{A_7}{3^7}=\frac{2(3)+2\left(3^3\right)+2\left(3^5\right)}{3^7}=\frac{2(1)+2\left(3^2\right)+2\left(3^4\right)}{3^6}=\frac{182}{729}, from which n=182.n=\boxed{182}.

~MRENTHUSIASM

Solution 3 (Multivariable Recursion by Table)

Define notation VkV_k as Solution 2 does.

In fact, we can generalize the following relationships for all nonnegative integers k:k:

A0=1,B0=0,C0=0,D0=0,Ak+1=Bk+Ck+Dk,Bk+1=Ak+Ck+Dk,Ck+1=Ak+Bk+Dk,Dk+1=Ak+Bk+Ck.\begin{aligned} A_0&=1, \\ B_0&=0, \\ C_0&=0, \\ D_0&=0, \\ A_{k+1}&=B_k+C_k+D_k, \\ B_{k+1}&=A_k+C_k+D_k, \\ C_{k+1}&=A_k+B_k+D_k, \\ D_{k+1}&=A_k+B_k+C_k. \\ \end{aligned} Using these equations, we recursively fill out the table below:

[2.5ex]k01234567[2.25ex]Ak10362160183546[2.25ex]Bk01272061182547[2.25ex]Ck01272061182547[2.25ex]Dk01272061182547\begin{array}{c||c|c|c|c|c|c|c|c} \hspace{7mm}&\hspace{6mm}&\hspace{6mm}&\hspace{6mm}&\hspace{6mm}&\hspace{6mm}&\hspace{6mm}&& \\ [-2.5ex] \boldsymbol{k} & \boldsymbol{0} & \boldsymbol{1} & \boldsymbol{2} & \boldsymbol{3} & \boldsymbol{4} & \boldsymbol{5} & \boldsymbol{6} & \boldsymbol{7} \\ \hline \hline &&&&&&&& \\ [-2.25ex] \boldsymbol{A_k} &1&0&3&6&21&60&183&546 \\ \hline &&&&&&&& \\ [-2.25ex] \boldsymbol{B_k} &0&1&2&7&20&61&182&547 \\ \hline &&&&&&&& \\ [-2.25ex] \boldsymbol{C_k} &0&1&2&7&20&61&182&547 \\ \hline &&&&&&&& \\ [-2.25ex] \boldsymbol{D_k} &0&1&2&7&20&61&182&547 \\ \end{array} Note that the paths from VV to AA and the paths from AA to VV have one-to-one correspondence. So, we must get

Ak+Bk+Ck+Dk=3kA_k+B_k+C_k+D_k=3^k for all values of k.k.

The requested probability is

p=A737=5462187=182729,p=\frac{A_7}{3^7}=\frac{546}{2187}=\frac{182}{729}, from which n=182.n=\boxed{182}.

~MRENTHUSIASM

Solution 4 (Single Variable Version of Solution 2)

Let ana_n denotes the number of ways that the bug arrives at AA after crawling nn meters, then we have a1=0a_1=0.

Notice that there is respectively 11 way to arrive at AA for each of the different routes after the previous n1n-1 crawls, excluding the possibility that the bug ends up at AA after the (n1)(n-1)th crawl (as it will be forced to move somewhere else.). Thus, we get the recurrence relation

an=3n1an1.a_n=3^{n-1}-a_{n-1}. Quick calculations yield

a7=36a6=36(3534+3332+3a1)=546.\begin{aligned} a_7&=3^6-a_6\\ &=3^6-\left(3^5-3^4+3^3-3^2+3-a_1\right)\\ &=546. \end{aligned} Thus, p=54637=182729n=182p=\frac{546}{3^7}=\frac{182}{729}\Longrightarrow n=\boxed{182}.

~Nafer

Solution 5 (Dynamic Programming)

Let A(n)A(n) be the probability the bug lands on vertex AA after crawling nn meters, B(n)B(n) be the probability the bug lands on vertex BB after crawling nn meters, and etc.

Note that A(1)=0A(1)=0 and B(1)=C(1)=D(1)=13.B(1)=C(1)=D(1)=\frac13. For n2,n\geq2, the probability that the bug land on each vertex after nn meters is 13\frac13 the sum of the probability the bug land on other vertices after crawling n1n-1 meters. So, we have

A(n)=13[B(n1)+C(n1)+D(n1)],B(n)=13[A(n1)+C(n1)+D(n1)],C(n)=13[A(n1)+B(n1)+D(n1)],D(n)=13[A(n1)+B(n1)+C(n1)].\begin{aligned} A(n) &= \frac13 \cdot [B(n-1) + C(n-1) + D(n-1)], \\ B(n) &= \frac13 \cdot [A(n-1) + C(n-1) + D(n-1)], \\ C(n) &= \frac13 \cdot [A(n-1) + B(n-1) + D(n-1)], \\ D(n) &= \frac13 \cdot [A(n-1) + B(n-1) + C(n-1)]. \end{aligned} It follows that A(n)=B(n1)=C(n1)=D(n1).A(n) = B(n-1) = C(n-1) = D(n-1).

We construct the following table:

AIME diagram

Therefore, the answer is n=182.n = \boxed{182}.

~isabelchen

Solution 6 (Generating Functions and Roots of Unity Filter / Casework)

The generating function for a problem with this general form (44 states, nn steps) is (x+x2+x3)n(x+x^2+x^3)^n, so the generating function of interest for this problem is (x+x2+x3)7(x+x^2+x^3)^7. Our goal is to find the coefficients of every x4nx^{4n} and add them up before dividing by 373^7. Here we have two ways to proceed:

1. Roots of Unity Filter

Let ω=eiπ/2\omega = e^{i\pi / 2}. We have that if G(x)=(x+x2+x3)7G(x) = (x+x^2+x^3)^7, then

G(1)+G(ω)+G(ω2)+G(ω3)4=21871114=546.\frac{G(1) + G(\omega) + G(\omega^2) + G(\omega^3)}{4} = \frac{2187-1-1-1}{4} = 546. From here, the desired probability is 5462187=182729\frac{546}{2187} = \frac{182}{729}. Therefore, the answer is n=182n=\boxed{182}.

~RedFlame2112

2. Casework

We can factor (x+x2+x3)7(x+x^2+x^3)^7 as x7(1+x+x2)7.x^7(1+x+x^2)^7. The x4nx^{4n} coefficients of (x+x2+x3)7(x+x^2+x^3)^7 will be the same as the x4n+1x^{4n+1} coefficients of (1+x+x2)7.(1+x+x^2)^7. The possible values for 4n+14n+1 would then be 1,1, 5,5, 9,9, and 13.13. Because 1+13=5+9=14,1+13=5+9=14, the coefficients of x1x^1 and x13x^{13} are equal and so are the coefficients of x5x^5 and x9.x^9. To make an xx term, we need 66 "11" terms and one "xx" term multiplied together. There are 77 ways to arrange these numbers. The coefficient of the x5x^5 term will be the sum of the number of the possible arrangements for these numbers:

0000122=105 arrangements,0001112=140 arrangements,0011111=21 arrangements.\begin{aligned} 0000122&=105\text{ arrangements}, \\ 0001112&=140\text{ arrangements}, \\ 0011111&=21\text{ arrangements}. \end{aligned} Thus, the coefficient of the x5x^5 term is 105+140+21=266.105+140+21=266. From here, the desired probability is 2(7+266)2187=5462187=182729.\frac{2(7+266)}{2187}=\frac{546}{2187}=\frac{182}{729}. Thus, our answer is 182.\boxed{182}.

~BS2012

Solution 7 (Partitions)

We can find the number of different times the bug reaches vertex AA before the 77th move, and use these smaller cycles to calculate the number of different ways the bug can end up back at A.A.

Define f(x)f(x) to be the number of paths of length xx which start and end at AA but do not pass through AA otherwise. Obviously f(1)=0.f(1) = 0. In general for f(x),f(x), the bug has three initial edges to pick from. From there, since the bug cannot return to AA by definition, the bug has exactly two choices. This continues from the 22nd move up to the (x1)(x-1)th move. The last move must be a return to A,A, so this move is determined. So f(x)=2x23.f(x) = 2^{x-2}3.

Now we need to find the number of cycles by which the bug can reach AA at the end. Since f(1)=0,f(1) = 0, we know that f(6)f(6) cannot be used, as on the 77th move the bug cannot move from AA to A.A. So we need to find the number of partitions of 77 using only 2,3,4,5,2,3,4,5, and 7.7. These are f(2)f(2)f(3),f(2)f(5),f(3)f(4),f(2)f(2)f(3),f(2)f(5),f(3)f(4), and f(7).f(7). We can calculate these and sum them up using our formula. Also, order matters, so we need to find the number of ways to arrange each partition:

(31)f(2)f(2)f(3)+(21)f(2)f(5)+(21)f(3)f(4)+f(7)=3(3)(3)(23)+2(3)(233)+2(23)(223)+(253)=546.{3\choose1}f(2)f(2)f(3) + {2\choose1}f(2)f(5) + {2\choose1}f(3)f(4) + f(7) = 3(3)(3)(2\cdot3) + 2(3)(2^33) + 2(2\cdot3)(2^23) + (2^53) = 546. Finally, this is a probability question, so we divide by 37,3^7, or 54637=18236.\frac{546}{3^7} = \frac{182}{3^6}. The answer is n=182.n=\boxed{182}.

Solution 8 (Sequences)

Note that this problem is basically equivalent to the following: How many distinct sequences of 88 integers a1,a2,a3,,a8a_1, a_2, a_3, \ldots, a_8 are there such that a1=a8=1,a_1 = a_8 = 1, ai{1,2,3,4}a_i \in \{1, 2, 3, 4\} for all 2i8,2 \leq i\leq 8, and aiai+1a_i \neq a_{i+1} for all 1i71 \leq i \leq 7?

Now consider the 88 integers modulo 4.4. Let b1,b2,b3,,b7b_1, b_2, b_3, \ldots, b_7 be a new sequence of integers such that bi=ai+1aimod4b_i = a_{i+1} - a_i \mod 4 for all 1i7.1 \leq i \leq 7.

Note that the condition is equivalent to that bi{1,2,3}b_i \in \{1, 2, 3\} for all 1i7,1 \leq i \leq 7, and since a1mod4=a8mod4,a_1 \mod 4 = a_8 \mod 4, b1+b2++b7b_1 + b_2 + \cdots + b_7 must be a multiple of 4.4.

Thus, our desired number of paths is equivalent to the number of ordered septuples of positive integers (b1,b2,,b7)(b_1, b_2, \ldots, b_7) such that bi{1,2,3}b_i \in \{1, 2, 3\} for all 1i71 \leq i \leq 7 and b1+b2++b7b_1 + b_2 + \cdots + b_7 is congruent to 0mod4.0 \mod 4.

We will now proceed with casework on the number of 22s in the septuple.

One 22: There are (71)=7\dbinom{7}{1} = 7 ways to arrange the 22, and (60)+(62)+(64)+(66)=25\dbinom{6}{0} + \dbinom{6}{2} + \dbinom{6}{4} + \dbinom{6}{6} = 2^5 valid ways (the proof of this combinatorial identity is left as an exercise to the reader) to arrange the 11s and 33s.

Three 22s: There are (73)=35\dbinom{7}{3} = 35 ways to arrange the 22s, and (41)+(43)=23\dbinom{4}{1} + \dbinom{4}{3} = 2^3 valid ways to arrange the 11s and 33s.

Five 22s: There are (75)=21\dbinom{7}{5} = 21 ways to arrange the 22s, and (20)+(22)=2\dbinom{2}{0} + \dbinom{2}{2} = 2 valid ways to arrange the 11s and 33s.

Adding up our cases, we obtain 732+358+212=5467 \cdot 32 + 35 \cdot 8 + 21 \cdot 2 = 546 valid sequences. Dividing by the total number of paths without restrictions, 37=2187,3^7 = 2187, our desired probability is 5462187=182729,\frac{546}{2187} = \frac{182}{729}, giving an answer of 182.\boxed{182}.

~fidgetboss_4000

Solution 9

We instead find the probability that the bug is NOT at vertex AA after crawling nn meters (equivalent to moving nn times). Call AnA_n the probability that the bug IS at vertex AA after nn moves; call OnO_n the probability that the bug is on some other vertex. We have the following recurrence relations.

An=13On1A_n = \frac{1}{3}O_{n-1} On=An1+23On1O_n = A_{n-1} + \frac{2}{3}O_{n-1} However, we can calculate An1A_{n-1} in terms of OnO_n; take n=k1n = k-1, and we have

Ak1=13Ok2A_{k-1} = \frac{1}{3}O_{k-2} . Substituting this into our equation for OO, we have that

On=13On2+23On1O_n = \frac{1}{3}O_{n-2} + \frac{2}{3}O_{n-1} . We also have the conditions that O0=0O_0 = 0 (the bug will not be at vertex other than AA on the "0th" move) and O1=1O_1 = 1 (the bug will be at a vertex other than AA after the 1st1st move). Iteratively calculating O7O_7, we find that it is equal to 547729\frac{547}{729} (I will not do this calculation here; you can do it manually if you wish to check). However, this is the probability that the ant is NOT at vertex AA after 77 moves; then its complement, 182729\frac{182}{729} is the probability that the ant IS at vertex AA after 77 moves, so our answer is 182\boxed{182}.

~ cxsmi

Solution 10 (Linear Algebra)

Think of the problem as a state machine with a transition matrix. State 1 is if the bug is at A, State 2 is if the bug is not at A. In vector form we can represent state 1 as [10]\begin{bmatrix} 1 \\ 0 \end{bmatrix} and state 2 as [01]\begin{bmatrix} 0 \\ 1 \end{bmatrix}. Our transition matrix T=(013123)T =\begin{pmatrix} 0 & \frac{1}{3} \\ 1 & \frac{2}{3} \end{pmatrix}. Thus the probability of being in each state after k moves is Tk[10]=(013123)k[10]T^{k}\begin{bmatrix} 1 \\ 0 \end{bmatrix}=\begin{pmatrix} 0 & \frac{1}{3} \\ 1 & \frac{2}{3} \end{pmatrix}^{k}\begin{bmatrix} 1 \\ 0 \end{bmatrix}. Those familiar with linear algebra will recognize the need to diagonalize the transition matrix through eigendecomposition. In short, the eigenvalues of the transition matrix are 13-\frac{1}{3} and 1, with corresponding eigenvector basis of (11),(131)\begin{pmatrix} 1 \\ -1 \end{pmatrix}, \begin{pmatrix} \frac{1}{3} \\ 1 \end{pmatrix}. Thus T=QΛQ1=(11311)(13001)(11311)1=(11311)(13001)(34143434)T = Q \Lambda Q^{-1} = \begin{pmatrix} 1 & \frac{1}{3} \\ -1 & 1 \end{pmatrix}\begin{pmatrix} -\frac{1}{3} & 0\\ 0 & 1 \end{pmatrix}\begin{pmatrix} 1 & \frac{1}{3}\\ -1 & 1 \end{pmatrix}^{-1} = \begin{pmatrix} 1 & \frac{1}{3} \\ -1 & 1 \end{pmatrix}\begin{pmatrix} -\frac{1}{3} & 0\\ 0 & 1 \end{pmatrix}\begin{pmatrix} \frac{3}{4} & -\frac{1}{4}\\ \frac{3}{4} & \frac{3}{4} \end{pmatrix}

Thus Tk[10]=(11311)((13)k001k)(34143434)[10]=(34(13)k+1414(13)k+1434(13)k+3414(13)k+34)[10]=[34(13)k+1434(13)k+34]T^{k}\begin{bmatrix} 1 \\ 0 \end{bmatrix}= \begin{pmatrix} 1 & \frac{1}{3} \\ -1 & 1 \end{pmatrix}\begin{pmatrix} (-\frac{1}{3})^{k} & 0\\ 0 & 1^{k} \end{pmatrix}\begin{pmatrix} \frac{3}{4} & -\frac{1}{4}\\ \frac{3}{4} & \frac{3}{4} \end{pmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{pmatrix} \frac{3}{4}(-\frac{1}{3})^{k}+\frac{1}{4} & -\frac{1}{4}(-\frac{1}{3})^{k}+\frac{1}{4}\\ -\frac{3}{4}(-\frac{1}{3})^{k}+\frac{3}{4} & \frac{1}{4}(-\frac{1}{3})^{k}+\frac{3}{4} \end{pmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} \frac{3}{4}(-\frac{1}{3})^{k}+\frac{1}{4} \\ -\frac{3}{4}(-\frac{1}{3})^{k}+\frac{3}{4} \end{bmatrix}.

The probability we seek is the top entry of this vector for k = 7, or 182729\frac{182}{729}.

Solution 11 (Regular Casework)

Perhaps you are not very good at recursion. Let AA denote the vertex A,A, and let NN denote a vertex other than A.A. Now the moves of the bug must look something like this:

NA.N - - - - - A. Note that the bug cannot travel to AA twice in a row, meaning it can't have an AA following an A,A, so there must be at least one NN in between. Therefore, the bug can only move to AA a maximum of 33 times (including the last one). Therefore, we will do casework based on how many times the bug moves to vertex A.A. \newline \newline Case 1:3 As1: \text{3 As}

There are three ways for the bug to move in this case:

N A N A N N A,\text{N A N A N N A}, N A N N A N A,\text{N A N N A N A}, N N A N A N A.\text{N N A N A N A}. \newline

Let P(XY)P(XY) denote the probability that the bug moves from vertex XX to vertex Y.Y. \newline P(NA)=13,P(NA) = \frac{1}{3}, because from a vertex NN there are three ways to go, with only one of them being A.A. \newline P(AN)=1,P(AN) = 1, self explanatory. \newline P(NN)=23,P(NN) = \frac{2}{3}, also self explanatory. \newline Now, using this (by multiplying the probabilities for each pair of consecutive letters), we find that each configuration has the same probability: (P(NN))(P(NA))3=281.(P(NN))(P(NA))^3 = \frac{2}{81}. Since each of these three configurations has this probability, we only need to multiply by 3,3, giving 2(3)81=227\frac{2(3)}{81} = \frac{2}{27} so far. \newline \newline Case 2:2 As2: \text{2 As}

This is a little simpler. The configuration:

NNNNANA,N N N N A N A, where AA can occupy any space from the second to the fifth. Note that each occupation gives the same probability once again, so we have (5(21))×(P(NN))3(P(NA))2=4×(23)3(13)2=32243.(5-(2-1))\times (P(NN))^3(P(NA))^2 = 4\times \left(\frac{2}{3}\right)^3\left(\frac{1}{3}\right)^2 = \frac{32}{243}. \newline \newline Case 3:1 A3:\text{1 A} Configuration:

NNNNNNAN N N N N N A The probability of this is simply (P(NN))5(P(NA))=2536=32729.(P(NN))^5(P(NA)) = \frac{2^5}{3^6} = \frac{32}{729}.

Adding this all up, we have

227+32243+32729=54+96+32729=182729182.\frac{2}{27} + \frac{32}{243} + \frac{32}{729} = \frac{54+96+32}{729} = \frac{182}{729} \Longrightarrow \boxed{182}. ~ martianrunner

Remark

Here is a similar problem from another AIME test: 2003 AIME II Problem 13, in which we have an equilateral triangle instead.

There is another similar problem from the AMC8: 2022 AMC 8 Problems/Problem 25, where we have the same question, just with less steps