The Monkeys Are At It Again

Once again, a very large crowd of monkeys is sitting at typewriters with 26 letter keys.

Each monkey types a string of N N letters at random. It turns out that almost exactly half of the monkeys has typed a string in which the same letter occurs three (or more) times in a row, as in B U W W W Z \mathtt{BUWWWZ}\dots . The other half of the monkeys typed a string in which no letter occurs more than twice in a row, as in L W W P W K \mathtt{LWWPWK}\dots .

Determine N / 10 \lfloor N/10 \rfloor .


Inspiration: A problem idea by David Fairer.


The answer is 48.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Consider an alphabet of α \alpha letters and a string of length n n . We call a string valid if it does not have three or more of the same letter in a row. Let X n X_n be the number of valid strings of length n n .

Obviously, all strings of lengths less than 3 are valid: X 1 = α ; X 2 = α 2 X_1 = \alpha;\ X_2 = \alpha^2 ; each valid string of length n 3 n \geq 3 is generated by

  • either taking a valid string of length n 1 n-1 and adding a letter unequal to the last letter, e.g. O L D O L D N \mathtt{OLD} \mapsto \mathtt{OLDN} ; there are α 1 \alpha-1 ways to choose the new letter.

  • or taking a valid string of length n 2 n-2 and adding twice a letter unequal to the last letter, e.g. O L O L N N \mathtt{OL} \mapsto \mathtt{OLNN} ; there are α 1 \alpha-1 ways to choose the new letter.

Thus X n = ( α 1 ) X n 1 + ( α 1 ) X n 2 X_n = (\alpha-1)X_{n-1} + (\alpha-1)X_{n-2} and To solve this recurrence relation, try a function of the form X n = p n X_n = p^n . Then p 2 = ( α 1 ) p + ( α 1 ) ; p^2 = (\alpha-1)p + (\alpha-1); p ± = 1 2 ( α 1 ) ± 1 2 ( α + 1 ) 2 4 . p_{\pm} = \tfrac12(\alpha-1) \pm \tfrac12\sqrt{(\alpha+1)^2 - 4}. The general solution of the recurrence relation is any linear combination of these solutions, i.e. X n = A + p + n + A p n . X_n = A_{+}p_{+}^n + A_{-}p_{-}^n.

From X 1 = α X_1 = \alpha and X 2 = α 2 X_2 = \alpha^2 we find that A ± = α 2 ( α 1 ) ± α 2 ( α + 1 ) 2 4 . A_\pm = \frac{\alpha}{2(\alpha-1)} \pm \frac{\alpha}{2\sqrt{(\alpha+1)^2 - 4}}.

However, it can be shown that the second term is always less than one half: A p n < 1 2 |A_{-}p_{-}^n| < \tfrac12 . Thus, we may simply round to an integer: X n = [ A + p + n ] = [ ( α 2 ( α 1 ) + α 2 ( α + 1 ) 2 4 ) ( 1 2 ( α 1 ) + 1 2 ( α + 1 ) 2 4 ) n ] . \boxed{X_n = [A_{+}p_{+}^n] = \left[\left(\dfrac{\alpha}{2(\alpha-1)} + \dfrac{\alpha}{2\sqrt{(\alpha+1)^2 - 4}}\right) \left(\tfrac12(\alpha-1) + \tfrac12\sqrt{(\alpha+1)^2 - 4}\right)^n\right]}.


Now we must calculate for which value N N , X N f α N X_N \approx f\alpha^N . The equation takes the form A + p + N f α N ; A_{+}p_{+}^N \approx f\alpha^N; The solution is N log f log A + log p + log α . N \approx \frac{\log f - \log A_{+}}{\log p_{+} - \log \alpha}. Substituting α = 26 \alpha = 26 , f = 0.5 f = 0.5 , we find N log 0.5 log 1.0028078 log 25.962912 log 26 = 487.54 ; N \approx \frac{\log 0.5 - \log 1.0028078}{\log 25.962912 - \log 26} = 487.54; the monkeys type strings of 487 or 488 letters. (The fraction of valid strings will be 50.04% and 49.97%, respectively.) The answer to the problem is thus N / 10 = 48 \lfloor N/10 \rfloor = \boxed{48} .

(Ugh, I think I didn't read the question carefully enough an thought it was asking for the number of monkeys...)

In a large crowd of monkeys by the law of large numbers would it matter, if I divided it by 10? I decided that in order to matter, the answer would have to be at least one order of magnitude higher than the actual solution.

First went for N itself, but I should enter an integer. Then entered 260, because I didn't know how to incorporate the 3 in my calculation.

Hmm, should I've thought that in order for it to make sense to divide it by 10, it need to be in the same order of magnitude if rounded? Maybe going for 49 if having to enter a natural number.

Julia Seidel - 3 years, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...