2015 AIME II Problems/Problem 12

Revision as of 17:54, 10 June 2024 by Bs2012 (talk | contribs) (Remark)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Problem

There are $2^{10} = 1024$ possible 10-letter strings in which each letter is either an A or a B. Find the number of such strings that do not have more than 3 adjacent letters that are identical.

Solution 1

Let $a_{n}$ be the number of ways to form $n$-letter strings made up of As and Bs such that no more than $3$ adjacent letters are identical.

Note that, at the end of each $n$-letter string, there are $3$ possibilities for the last letter chain: it must be either $1$, $2$, or $3$ letters long. Removing this last chain will make a new string that is $n-1$, $n-2$, or $n-3$ letters long, respectively.

Therefore we can deduce that $a_{n}=a_{n-1}+a_{n-2}+a_{n-3}$.

We can see that \[a_{1}=2\] \[a_{2}=2^{2}=4\] \[a_{3}=2^{3}=8\] so using our recursive relation we find \[a_{4}=14\] \[a_{5}=26\] \[a_{6}=48\] \[a_{7}=88\] \[a_{8}=162\] \[a_{9}=298\] \[a_{10}=\boxed{548}\]

Solution 2

The solution is a simple recursion:

We have three cases for the ending of a string: three in a row, two in a row, and a single:

...AAA $(1)$ ...BAA $(2)$ ...BBA or ...ABA $(3)$

(Here, WLOG each string ends with A. This won't be the case when we actually solve for values in recursion.)

For case $(1)$, we could only add a B to the end, making it a case $(3)$. For case $(2)$, we could add an A or a B to the end, making it a case $(1)$ if you add an A, or a case $(3)$ if you add a B. For case $(3)$, we could add an A or a B to the end, making it a case $(2)$ or a case $(3)$.

Let us create three series to represent the number of permutations for each case: $\{a\}$, $\{b\}$, and $\{c\}$ representing case $(1)$, $(2)$, and $(3)$ respectively.

The series have the following relationship:

$a_n=b_{n-1}$; $b_n=c_{n-1}$; $c_n=c_{n-1}+a_{n-1}+b_{n-1}$

For $n=3$: $a_3$ and $b_3$ both equal $2$, $c_3=4$. With some simple math, we have: $a_{10}=88$, $b_{10}=162$, and $c_{10}=298$. Summing the three up we have our solution: $88+162+298=\boxed{548}$.

Solution 3

This is a recursion problem. Let $a_n$ be the number of valid strings of $n$ letters, where the first letter is $A$. Similarly, let $b_n$ be the number of valid strings of $n$ letters, where the first letter is $B$.

Note that $a_n=b_{n-1}+b_{n-2}+b_{n-3}$ for all $n\ge4$.

Similarly, we have $b_n=a_{n-1}+a_{n-2}+a_{n-3}$ for all $n\ge4$.

Here is why: every valid strings of $n$ letters $(n\ge4)$ where the first letter is $A$ must begin with one of the following:

$AAAB$ - and the number of valid ways is $b_{n-3}$.

$AAB$ - and the number of valid ways is $b_{n-2}$.

$AB$ - and there are $b_{n-1}$ ways.

We know that $a_1=1$, $a_2=2$, and $a_3=4$. Similarly, we have $b_1=1$, $b_2=2$, and $b_3=4$. We can quickly check our recursion to see if our recursive formula works. By the formula, $a_4=b_3+b_2+b_1=7$, and listing out all $a_4$, we can quickly verify our formula.

Therefore, we have the following:

$\begin{tabular}{c|c|c|c|c|c|c|c|c|c|c}Value of n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\\hline a & 1 & 2 & 4 & 7 & 13 & 24 & 44 & 81 & 149 & 274\\b & 1 & 2 & 4 & 7 & 13 & 24 & 44 & 81 & 149 & 274\end{tabular}$

The total number of valid $10$ letter strings is equal to $a_{10}+b_{10}=274+274=\boxed{548}$.

Notice that $a_n = b_n$, since $a_1=b_1$, $a_2=b_2$, and $a_3=b_3$. Therefore, we didn't really need to list out both recursion formulas, which could save us some time.

Solution 4 (Without Recursion)

Playing around with strings gives this approach: We have a certain number of As, then Bs, and so on. Therefore, what if we denoted each solution with numbers like $(3,3,3,1)$ to denote AAABBBAAAB or vice versa (starting with Bs)? Every string can be represented like this!

We can have from 4 to 10 numbers in our parentheses. For each case, we will start with the largest number possible, usually a bunch of 3s, then go down systematically. Realize also that if we are left with just 2s and 1s, there is only one number of 2s and 1s that adds up to the leftover amount. Our final answer is the sum of all of these parenthetical sets [each set multiplied by its permutations, as order matters] multiplied by two [starting with either A or B, and alternating as we go along].

$4 \rightarrow (3,3,3,1) = 4, (3,3,2,2) = 6$

$5 \rightarrow (3, 3, 2, 1, 1) = 30, (3, 2, 2, 2, 1) = 20, (2,2,2,2,2)=1$

$6 \rightarrow (3,3,1,1,1,1) = 15, (3,2,2,1,1,1) = 60, (2,2,2,2,1,1) = 15$

$7 \rightarrow (3,2,1,1,1,1,1) = 42, (2,2,2,1,1,1,1) = 35$

$8 \rightarrow (3,1...1) = 8, (2,2,1...1) = 28$

$9 \rightarrow (2,1...1) = 9$

$10 \rightarrow (1,1....1) =1$

Adding them all up gives you 274; multiplying by 2 gives $\boxed{548}$.

Solution 5

We are going to build the string, 1 character at a time. And, we are going to only care about the streak of letters at the end of the string.

Let $a_n$ be the number of strings of length n that satisfy the problem statement and also has a "streak" of length 1 at the end. ABABBA has a streak of length 1.

Let $b_n$ be the number of strings of length n that satisfy the problem statement and also has of length 2 at the end. ABABBAA has a streak of length 2. There are 2 "A" s at the end of the string.

Let $c_n$ be the number of string of length n that that satisfy the problem statement and also has a "streak" of length 3 at the end. ABABBAAA has a streak of length 3. There are 3 "A" s at the end of the string.

Let's establish a recursive relationship. $a_{n+1} = a_n+b_n+c_n$, since you can simply break the streak. $b_{n+1} = a_n$, and $c_{n+1} = b_n$ Since you can just add to the streak.

We can log everything using a table.

$\begin{tabular}{c|c|c|c|c|c|c|c|c|c|c}Value of n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\\hline a & 2 & 2 & 4 & 8 & 14 & 26 & 48 & 88 & 162 & 298\\b & 0 & 2 & 2 & 4 & 8 & 14 & 26 & 48 & 88 & 162 \\c & 0 & 0 & 2 & 2 &4 & 8 & 14 & 26 & 48 & 88\end{tabular}$

Adding $a_{10}$, $b_{10}$, $c_{10}$ gets the total number of numbers that doesn't have more than 3 concecutive letters.

That gets a total of $298+162+88 = \boxed{548}$

-AlexLikeMath

Solution 6

Let $S_n$ be the number of n-letter strings satisfying the problem criteria. Then we can easily see $S_1 = 2, S_2 = 4, S_3 = 8, S_4 = 16-2 =14$. For $n \ge 4$ consider the last three elements of the list. For example to get $S_5$ we could try to take $S_4$ and multiply by 2 since for each $S_4$ string we have two choices for the fifth character. However we have to be careful if the last three characters of $S_4$ are all the same, as in that case we would be overcounting, (i.e if we have a string $\dots aaa$, we can only add $b$ to the end so that the problem criteria is satisfied. Additionally strings such as $\dots aaa$ or $\dots bbb$ should only be counted once as we only have one choice for the $n$th character to add ($b$ and $a$ respectively).

Thus to compute $S_n$ we start with $S_{n-1}$ then take out the strings ending in $\dots bbb$ or $\dots aaa$. There are $S_{n-4}$ remaining valid strings (i.e if we pick any of the $S_{n-4}$ valid strings, examine the last character, if it is a $b$ then we append $aaa$ to it, and if if it an $a$ we append $bbb$ to it, hence the number of $S_{n-1}$ strings are in one-to-one correspondence with the number of strings in $S_{n-4}$. Thus we have the recursion $S_n = 2(S_{n-1} - S_{n-4}) + S_{n-4}$ (where we are first taking away $S_{n-4}$, doubling the result, then adding $S_{n-4}$ back in signifying that we only count it once, as described above).

The recursion simplifies to $S_n = 2S_{n-1} - S_{n-4}$ and we can now quickly compute the remaining values: \[S_5 = 2S_4 - S_1 = 26, S_6 = 2(26)-4 = 48, S_7 = 2(48) - 8 = 88, S_8 = 2(88) - 14 = 162, S_9 = 2(162) - 26 = 298, S_{10} = 2S_9 - 48 = \boxed{548}\]

~afroromanian

Solution 7 (Generating Functions)

Let us define a "run" as a set of consecutive letters that are all the same and let a "maximal run" be a run that is not the proper subset of any other run, in other words, it cannot be expanded.

From now on, we consider all runs to be maximal.

Note that the minimum number of runs in the $10$-letter string is $4$ (or else the Pigeonhole Principle tells us that at least $1$ run has $4$ or more letters in it, contradiction), and the maximum number of runs is clearly $10.$

Since an arbitrary run can have anywhere from $1$ to $3$ letters in it, it follows that the number of $10$-letter strings with $n$ runs (where $4 \leq n \leq 10$) is\[2[x^{10}] (x+x^2+x^3)^n,\]i.e. twice the coefficient of $x^{10}$ in the expansion of $(x+x^2+x^3)^n.$ (Note that we multiplied by $2$ because there are two choices for which letter the first run has and then the rest are fixed).

Hence, we wish to find\[2\sum_{n=4}^{10} [x^{10}] (x+x^2+x^3)^n.\] First, we can rewrite this as n=410[x10](x+x2+x3)n=n=410[x10] xn(1+x+x2)n=n=410[x10n](1x31x)n=n=410[x10n](1x3)n(1x)n. Now, we proceed case by case, utilizing the Binomial Theorem for the numerator in all of the cases:

For $n=4,$ we have [x6](1x3)4(1x)4=(40)[x6](1x)4(41)[x3](1x)4+(42)[x0](1x)4=1(93)4(63)+6(33)=184420+61=8480+6=10. For $n=5,$ we have [x5](1x3)5(1x)5=(50)[x5](1x)5(51)[x2](1x)5=1(94)5(64)=1126515=12675=51.For $n=6,$ we have [x4](1x3)6(1x)6=(60)[x4](1x)6(61)[x1](1x)6=1(95)6(65)=112666=12636=90.For $n=7,$ we have [x3](1x3)7(1x)7=(70)[x3](1x)7(71)[x0](1x)7=1(96)7(66)=18471=847=77.For $n=8,$ we have [x2](1x3)8(1x)8=(80)[x2](1x)8=1(97)=136=36.For $n=9,$ we have [x1](1x3)9(1x)9=(90)[x1](1x)9=1(98)=19=9.For $n=10,$ we have [x0](1x3)10(1x)10=[x0](1x)10=1(99)=11=1.Hence, the answer is 2n=410[x10n](1x3)n(1x)n=2(10+51+90+77+36+9+1)=2274=548.

-lpieleanu

Remark

2015 AMC 12A #22 is a harder version of this problem.

See also

2015 AIME II (ProblemsAnswer KeyResources)
Preceded by
Problem 11
Followed by
Problem 13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
All AIME Problems and Solutions

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. AMC logo.png