CEMC Banner

Counting and Probability
Solutions

  1. When an integer is divided by 3, there are only three possibilities for the remainder: 0, 1, or 2. Therefore, each of these integers is of the form 3k, 3k+1 or 3k+2 for some non-negative integer k. If we don’t have three integers each of a different form, then the five integers have two possible forms and so there must at least three integers of the same form.

    If we have three integers of the same form, then the sum of these three integers is 3k1+3k2+3k3=3(k1+k2+k3) or 3k1+1+3k2+1+3k3+1=3(k1+k2+k3+1) or 3k1+2+3k2+2+3k3+2=3(k1+k2+k3+2)

    If we have three integers all of different form, then the sum of these three integers is 3k1+3k2+1+3k3+2=3(k1+k2+k3+1)

    In all cases, these sums are divisible by 3 and so we can always choose three of the five integers such that their sum is divisible by 3.

  2. There are 7!=7654321 permutations of 1,2,3,4,5,6,7, because there are 7 choices for a1, then 6 choices for a2, and so on.

    We determine the average value of a1a2+a3a4+a5a6+a7 over all of these permutations by determining the sum of all 7! values of this expression and dividing by 7!.

    To determine the sum of all 7! values, we determine the sum of the values of a1 in each of these expressions and call this total s1, the sum of the values of a2 in each of these expressions and call this total s2, and so on.

    The sum of the 7! values of the original expression must equal s1s2+s3s4+s5s6+s7. This uses the fact that, when adding, the order in which we add the same set of numbers does not matter.

    By symmetry, the sums of the values of a1,a2,a3,a4,a5,a6,a7 will all be equal. That is, s1=s2=s3=s4=s5=s6=s7.

    This means that the desired average value equals s1s2+s3s4+s5s6+s77!=(s1+s3+s5+s7)(s2+s4+s6)7!=4s13s17!=s17! So we need to determine the value of s1.

    Now a1 can equal each of 1,2,3,4,5,6,7.

    If a1=1, there are 6! combinations of values for a2, a3, a4, a5, a6, a7, since there are still 6 choices for a2, 5 for a3, and so on.

    Similarly, there are 6! combinations with a1 equal to each of 2, 3, 4, 5, 6, 7.

    Thus, s+1=16!+26!+36!+46!+56!+66!+76!=6!(1+2+3+4+5+6+7)=28(6!). Therefore, the average value of the expression is 28(6!)7!=28(6!)7(6!)=287=4.

  3. We consider choosing the three numbers all at once.

    We list the possible sets of three numbers that can be chosen:

    We have listed each in increasing order because once the numbers are chosen, we arrange them in increasing order.

    There are 10 sets of three numbers that can be chosen.

    Of these 10 sets, the 4 sequences 1,2,3 and 1,3,5 and 2,3,4 and 3,4,5 are arithmetic sequences.

    Therefore, the probability that the resulting sequence is an arithmetic sequence is 410 or 25.

  4. There are five odd digits: 1, 3, 5, 7, 9.

    We consider the positive integers less than 1000 in three sets: those with one digit, those with two digits, and those with three digits.

    There are 5 positive one-digit integers with one odd digit (namely 1, 3, 5, 7, 9).

    Consider the two-digit positive integers with only odd digits. Such an integer has the form XY where X and Y are digits. There are five possibilities for each of X and Y (since each must be odd). Therefore, there are 5×5=25 two-digit positive integers with only odd digits.

    Consider the three-digit positive integers with only odd digits. Such an integer has the form XYZ where X, Y and Z are digits. There are five possibilities for each of X, Y and Z (since each must be odd). Therefore, there are 5×5×5=125 three-digit positive integers with only odd digits.

    In total, there are 5+25+125=155 positive integers less than 1000 with only odd digits.

  5. We make a table of the 36 possible combinations of rolls and the resulting sums:

    2 3 5 7 11 13
    2 4 5 7 9 13 15
    3 5 6 8 10 14 16
    5 7 8 10 12 16 18
    7 9 10 12 14 18 20
    11 13 14 16 18 22 24
    13 15 16 18 20 24 26

    Of the 36 entries in the table, 6 are prime numbers (two entries each of 5, 7 and 13). Therefore, the probability that the sum is a prime number is 636 or 16.

    (Note that each sum is at least 4 and so must be odd to be prime. Since odd plus odd equals even, then the only possibilities that really need to be checked are even plus odd and odd plus even, that is, the first row and first column of the table.)

  6. Solution 1

    There are two possibilities: either each player wins three games or one player wins more games than the other.

    Since the probability that each player wins three games is 516, the probability that any one player wins more games than the other is 1516=1116.

    Since each of Blaise and Pierre is equally likely to win any given game, each must be equally likely to win more games than the other.

    Therefore, the probability that Blaise wins more games than Pierre is 12×1116=1132.

    Solution 2

    We consider the results of the 6 games as a sequence of 6 Bs or Ps, with each letter a B if Blaise wins the corresponding game or P if Pierre wins.

    Since the two players are equally skilled, the probability that each wins a given game is 12. This means that the probability of each letter being a B is 12 and the probability of each letter being a P is also 12.

    Since each sequence consists of 6 letters, the probability of a particular sequence occurring is (12)6=164, because each of the letters is specified.

    Since they play 6 games in total, the probability that Blaise wins more games than Pierre is the sum of the probabilities that Blaise wins 4 games, that Blaise wins 5 games, and that Blaise wins 6 games.

    If Blaise wins 6 games, then the sequence consists of 6 Bs. The probability of this is 164, since there is only one way to arrange 6 Bs.

    If Blaise wins 5 games, then the sequence consists of 5 Bs and 1 P. The probability of this is 6×164=664, since there are 6 possible positions in the list for the 1 P (eg. PBBBBB, BPBBBB, BBPBBB, BBBPBB, BBBBPB, BBBBBP).

    The probability that Blaise wins 4 games is (62)×164=1564, since there are (62)=15 ways for 4 Bs and 2 Ps to be arranged.

    Therefore, the probability that Blaise wins more games than Pierre is 164+664+1564=2264=1132.

  7. Solution 1

    Suppose that the bag contains g gold balls. We assume that Feridun reaches into the bag and removes the two balls one after the other.

    There are 40 possible balls that he could remove first and then 39 balls that he could remove second. In total, there are 40(39) pairs of balls that he could choose in this way.

    If he removes 2 gold balls, then there are g possible balls that he could remove first and then g1 balls that he could remove second. In total, there are g(g1) pairs of gold balls that he could remove.

    We are told that the probability of removing 2 gold balls is 512. Since there are 40(39) total pairs of balls that can be chosen and g(g1) pairs of gold balls that can be chosen in this way, we have g(g1)40(39)=512 which is equivalent to g(g1)=512(40)(39)=650.

    Therefore, g2g650=0 or (g26)(g+25)=0, and so g=26 or g=25. Since g>0, we have g=26, so there are 26 gold balls in the bag.

    Solution 2

    Suppose that the bag contains g gold balls. We assume that Feridun reaches into the bag and removes the two balls together.

    Since there are 40 balls in the bag, there are (402) pairs of balls that he could choose in this way.

    Since there are g gold balls in the bag, there are (g2) pairs of gold balls that he could choose in this way.

    We are told that the probability of removing 2 gold balls is 512. Since there are (402) pairs in total that can be chosen and (g2) pairs of gold balls that can be chosen in this way, we have (g2)(402)=512 which is equivalent to (g2)=512(402). Since (n2)=n(n1)2, this equation is equivalent to g(g1)2=51240(39)2=325.

    Therefore, g(g1)=650 or g2g650=0 or (g26)(g+25)=0, and so g=26 or g=25. Since g>0, we have g=26, so there are 26 gold balls in the bag.

  8. The number of integers between 100 and 999 inclusive is 999100+1=900.

    An integer n in this range has three digits, say a, b and c, with the hundreds digit equal to a. Note that 0b9 and 0c9 and 1a9.

    To have a+b+c=24, then the possible triples for a,b,c in some order are 9,9,6; 9,8,7; 8,8,8. (There cannot be three 9’s. If there are two 9’s, the the other digit equals 6. If there is one 9, the second and third digits add to 15 but are both less than 9, so must equal 8 and 7. If there are zero 9’s, the maximum for each digit is 8, and so each digit must be 8 in order for the sum of all three to equal 24.)

    If the digits are 9, 9 and 6, there are 3 arrangements: 996, 969, 699.

    If the digits are 9, 8 and 7, there are 6 arrangements: 987, 978, 897, 879, 798, 789.

    If the digits are 8, 8 and 8, there is only 1 arrangement: 888.

    Therefore, there are 3+6+1=10 integers n in the range 100 to 999 with the sum of the digits of n equal to 24.

    The required probability equals the number of possible values of n with the sum of digits equal to 24 divided by the total number of integers in the range, or 10900=190.

  9. Suppose that Billy removes the ball numbered x from his bag and that Crystal removes the ball numbered y from her bag.

    Then b=1+2+3+4+5+6+7+8+9x=45x.

    Also, c=1+2+3+4+5+6+7+8+9y=45y.

    Hence, bc=(45x)(45y)=yx.

    Since 1x9 and 1y9, we have 8yx8. (This is because yx is maximized when y is largest (that is, y=9) and x is smallest (that is, x=1), so yx91=8. Similarly, yx8.)

    Since bc=yx is between 8 and 8, for it to be a multiple of 4, bc=yx must be 8, 4, 0, 4, or 8.

    Since each of Billy and Crystal chooses 1 ball from 9 balls and each ball is equally likely to be chosen, the probability of any specific ball being chosen from one of their bags is 19. Thus, the probability of any specific pair of balls being chosen (one from each bag) is 19×19=181.

    Therefore, to compute the desired probability, we must count the number of pairs (x,y) where yx is 8, 4, 0, 4, 8, and multiply this result by 181.

    Method 1

    If yx=8, then (x,y) must be (9,1).
    If yx=8, then (x,y) must be (1,9).
    If yx=4, then (x,y) can be (5,1), (6,2), (7,3), (8,4), (9,5).
    If yx=4, then (x,y) can be (1,5), (2,6), (3,7), (4,8), (5,9).
    If yx=0, then (x,y) can be (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9).
    There are thus 21 pairs (x,y) that work, so the desired probability is 2181=727.

    Method 2

    If x=9, then for yx to be a multiple of 4, y must be 9, 5 or 1.
    If x=8, then for yx to be a multiple of 4, y must be 8 or 4.
    If x=7, then for yx to be a multiple of 4, y must be 7 or 3.
    If x=6, then for yx to be a multiple of 4, y must be 6 or 2.
    If x=5, then for yx to be a multiple of 4, y must be 9, 5 or 1.
    If x=4, then for yx to be a multiple of 4, y must be 8 or 4.
    If x=3, then for yx to be a multiple of 4, y must be 7 or 3.
    If x=2, then for yx to be a multiple of 4, y must be 6 or 2.
    If x=1, then for yx to be a multiple of 4, y must be 9, 5 or 1.
    There are thus 21 pairs (x,y) that work, so the desired probability is 2181=727.

  10. If she tosses 3 heads on the first toss, then she has no coins to toss on the second toss, so she cannot toss exactly 1 head.

    If she tosses 2, 1 or 0 heads on the first toss, then she has at least one coin to toss on the second toss, so it is possible for her to toss exactly 1 head on the second toss.

    The following possibilities exist:

    We calculate the various probabilities.

    If 3 coins are tossed, there are 8 equally likely possibilities: HHH, HHT, HTH, THH, TTH, THT, HTT, TTT. Each of these possibilities has probability (12)3=18. Therefore,

    If 2 coins are tossed, there are 4 equally likely possibilities: HH, HT, TH, TT. Each of these possibilities has probability (12)2=14. Therefore, the probability of tossing 1 head out of 2 coins is 24=12.

    If 1 coin is tossed, the probability of tossing 1 head is 12.

    To summarize, the possibilities are

    Therefore, the overall probability is 3812+3812+1838=2764.

  11. Let P(10) be the probability the product of the numbers on the two balls chosen is divisible by 10.

    Since there are 10 balls in each bag, there are 1010=100 pairs of balls that can be chosen.

    Let a be the number on the first ball chosen and b be the number on the second ball chosen. To determine P(10), we count the number of pairs (a,b) for which ab is divisible by 10. If the number of pairs is m, then P(10)=m100.

    For ab to be divisible by 10, at least one of a and b must be a multiple of 5 and at least one of a and b must be even.

    If a=10 or b=10, then the pair (a,b) gives a product ab divisible by 10. In this case, we obtain the 19 pairs (a,b)=(1,10),(2,10),,(9,10),(10,10),(10,9),,(10,2),(10,1) If neither a nor b equals 10, then either a=5 or b=5 in order for a or b to be divisible by 5. In this case, the other of a and b must be even and not equal to 10. (We have already counted the pairs where a=10 or b=10.) In this case, we obtain the 8 pairs (a,b)=(5,2),(5,4),(5,6),(5,8),(2,5),(4,5),(6,5),(8,5) From our work above, there are no additional pairs for which ab is divisible by 10.

    Thus, there are 19+8=27 pairs (a,b) for which ab is divisible by 10, which means that P(10)=27100. (We note that we could have made a 10 by 10 table that listed all possible combinations of a and b and their product, from which we could obtain P(10).)

  12. There are 210=1024 strings of ten letters, each of which is A or B, because there are 2 choices for each of the 10 positions in the string.

    We determine the number of these strings that do not include the "substring" ABBA (that is, that do not include consecutive letters ABBA) by counting the number of strings that do include the substring ABBA and subtracting this total from 1024.

    If a string includes the substring ABBA, there are 7 possible positions in which this substring could start (ABBAxxxxxx,xABBAxxxxx,,xxxxxxABBA). There are 2 choices for each of the remaining 6 letters in such a string, so there are 726=448 occurrences of the substring ABBA among the 1024 strings.

    This does not mean that there are 448 strings that contain the substring ABBA. Since ABBA can appear multiple times in a single string, this total will count some strings more than once. (For example, the string ABBAAAABBA is included in both the first and seventh of these categories, so this string is counted twice.)

    So we must "correct"this total of 448 by accounting for the strings in which ABBA occurs more than once.

    Since two substrings of ABBA can overlap in 0 letters (for example, ABBAABBAxx) or in 1 letter (for example, ABBABBAxxx), the maximum number of times that the substring ABBA can appear is 3, and there is only one such string: ABBABBABBA.

    If a string contains two copies of ABBA that overlap, then it must be of one of the following forms: ABBABBAxxx,xABBABBAxx,xxABBABBAx,xxxABBABBA Since there are 4 choices for the starting position of ABBABBA and 2 choices for each of the three unknown letters, then there are 423=32 occurrences of ABBABBA among all of these strings.

    But the string ABBABBABBA is counted in each of the first and last categories, so we subtract 2 occurrences from this total to obtain 30, the total number of strings of ten letters that included exactly two overlapping copies of ABBA. (We’ll count the string ABBABBABBA later.)

    If a string contains exactly two substrings of ABBA and these do not overlap, then it must be of one of the following forms: ABBAABBAxx,ABBAxABBAx,ABBAxxABBA,xABBAABBAx,xABBAxABBA,xxABBAABBA Since there are 6 such forms and 2 choices for each of the 2 unknown letters in each case, there appear to be 622=24 such strings.

    This total includes the string ABBABBABBA in the third category, so we subtract 1 from this total to obtain 23, the total number of strings of ten letters that include exactly two copies of ABBA which do not overlap.

    So there are 30 strings that contain exactly two overlapping substrings ABBA, 23 strings that contain exactly two non-overlapping substrings ABBA, and 1 string that contains exactly three substrings ABBA.

    To get the total number of strings with one or more substrings ABBA we take the total number of occurrences of ABBA (448), subtract the number of strings with exactly two substrings ABBA (since these were included twice in the original count), and subtract two times the number of strings with exactly three substrings ABBA (since these were included three times in the original count).

    Therefore, there are 448233021=393 strings that include at least one substring ABBA, and so there are 1024393=631 strings of ten letters that do not include the substring ABBA.

  13. The Eden sequences from {1,2,3,4,5} are

    There are 12 such sequences.

    We present a brief justification of why these are all of the sequences.

  14. Throughout this problem, we represent the states of the n plates as a string of 0’s and 1’s (called a binary string) of length n of the form p1p2pn, with the rth digit from the left (namely pr) equal to 1 if plate r contains a gift and equal to 0 if plate r does not. We call a binary string of length n allowable if it satisfies the requirements – that is, if no two adjacent digits both equal 1. Note that digit pn is also "adjacent" to digit p1, so we cannot have p1=pn=1.

    1. Suppose that p1=1. Then p2=p7=0, so the string is of the form 10p3p4p5p60.

      Since k=3, we know that 2 of p3, p4, p5, p6 equal 1, but in such a way that no two adjacent digits are both 1. The possible strings in this case are 1010100, 1010010 and 1001010.

      Suppose that p1=0. Then p2 can equal 1 or 0.

      If p2=1, then p3=0 as well. This means that the string is of the form 010p4p5p6p7, which is the same as the general string in the first case, but shifted by 1 position around the circle, so there are again 3 possibilities.

      If p2=0, then the string is of the form 00p3p4p5p6p7 and 3 of the digits p3, p4, p5, p6, p7 equal 1 in such a way that no 2 adjacent digits equal 1. There is only 1 way in which this can happen: 0010101.

      Overall, this gives 7 possible configurations, so f(7,3)=7.

    2. Solution 1

      An allowable string p1p2pn1pn has (p1,pn)=(1,0), (0,1), or (0,0).

      Define g(n,k,1,0) to be the number of allowable strings of length n, containing k 1’s, and with (p1,pn)=(1,0). We define g(n,k,0,1) and g(n,k,0,0) in a similar manner.

      Note that f(n,k)=g(n,k,1,0)+g(n,k,0,1)+g(n,k,0,0).

      Consider the strings counted by g(n,k,0,1). Since pn=1, we know that pn1=0. Since p1=0, the digit p2 can equal 0 or 1.

      We remove the first and last digits of these strings. We obtain strings p2p3pn2pn1 that is strings of length n2 containing k1 1’s.

      Since pn1=0, the first and last digits of these strings are not both 1. Also, since the original strings did not contain two consecutive 1’s, these new strings does not either.

      Therefore, p2p3pn2pn1 are allowable strings of length n2 containing k1 1’s, with pn1=0 and p2=1 or p2=0.

      The number of such strings with p2=1 and pn1=0 is g(n2,k1,1,0) and the number of such strings with p2=0 and pn1=0 is g(n2,k1,0,0). Thus, g(n,k,0,1)=g(n2,k1,1,0)+g(n2,k1,0,0).

      Consider the strings counted by g(n,k,0,0). Since p1=0 and pn=0, we can remove pn to obtain strings p1p2pn1 of length n1 containing k 1’s. These strings are allowable since p1=0 and the original strings were allowable. Note that we have p1=0 and pn1 is either 0 or 1.

      So the strings p1p2pn1 are allowable strings of length n1 containing k 1’s, starting with 0, and ending with 0 or 1.

      The number of such strings with p1=0 and pn1=0 is g(n1,k,0,0) and the number of such strings with p1=0 and pn1=1 is g(n1,k,0,1). Thus, g(n,k,0,0)=g(n1,k,0,0)+g(n1,k,0,1).

      Consider the strings counted by g(n,k,1,0). Here, p1=1 and pn=0. Thus, pn1 can equal 0 or 1. We consider these two sets separately.

      If pn1=0, then the string p1p2pn1 is an allowable string of length n1, containing k 1’s, beginning with 1 and ending with 0. Therefore, the number of strings counted by g(n,k,1,0) with pn1=0 is equal to g(n1,k,1,0).

      If pn1=1, then the string p2p3pn1 is of length n2, begins with 0 and ends with 1. Also, it contains k1 1’s (having removed the original leading 1) and is allowable since the original string was. Therefore, the number of strings counted by g(n,k,1,0) with pn1=1 is equal to g(n2,k1,0,1).

      Therefore, f(n,k)=g(n,k,1,0)+g(n,k,0,1)+g(n,k,0,0)=(g(n1,k,1,0)+g(n2,k1,0,1))+(g(n2,k1,1,0)+g(n2,k1,0,0))+(g(n1,k,0,0)+g(n1,k,0,1))=(g(n1,k,1,0)+g(n1,k,0,1)+g(n1,k,0,0))+(g(n2,k1,0,1)+g(n2,k1,1,0)+g(n2,k1,0,0))=f(n1,k)+f(n2,k1) as required.

      Solution 2

      We develop an explicit formula for f(n,k) by building these strings.

      Consider the allowable strings of length n that include k 1’s. Either pn=0 or pn=1.

      Consider first the case when pn=0. Here, p1 can equal 0 or 1. These strings are all of the form p1p2p3pn10. In this case, since a 1 is always followed by a 0 and the strings end with 0, we can build these strings using blocks of the form 10 and 0. Any combination of these blocks will be an allowable string, as each 1 will always be both preceded and followed by a 0. Thus, these strings can all be built using k 10 blocks and n2k 0 blocks. This gives k 1’s and k+(n2k)=nk 0’s. Note that any string built with these blocks will be allowable and will end with a 0, and any such allowable string can be built in this way. The number of ways of arranging k blocks of one kind and n2k blocks of another kind is (k+(n2k)k), which simplifies to (nkk).

      Consider next the case when pn=1. Here, we must have pn1=p1=0, since these are the two digits adjacent to pn. Thus, these strings are all of the form 0p2p301.

      Consider the strings formed by removing the first and last digits. These strings are allowable, are of length n2, include k1 1’s, end with 0, and can begin with 0 or 1. Again, since a 1 is always followed by a 0 and the strings end with 0, we can build these strings using blocks of the form 10 and 0. Any combination of these blocks will be an allowable string, as each 1 will always be both preceded and followed by a 0. Translating our method of counting from the first case, there are ((n2)(k1)k1) or (nk1k1) such strings.

      Thus, f(n,k)=(nkk)+(nk1k1) such strings.

      To prove the desired fact, we will use the fact that (mr)=(m1r)+(m1r1), which we prove at the end. Now f(n1,k)+f(n2,k1)=((n1)kk)+((n1)k1k1)+((n2)(k1)k1)+((n2)(k1)1(k1)1)=(nk1k)+(nk2k1)+(nk1k1)+(nk2k2)=(nk1k)+(nk1k1)+(nk2k1)+(nk2k2)=(nkk)+(nk1k1)(using the identity above)=f(n,k) as required.

      To prove the identity, we expand the terms on the right side: (m1r)+(m1r1)=(m1)!r!(mr1)!+(m1)!(r1)!(mr)!=(m1)!(mr)r!(mr1)!(mr)+r(m1)!r(r1)!(mr)!=(m1)!(mr)r!(mr)!+r(m1)!r!(mr)!=(m1)!(mr+r)r!(mr)!=(m1)!mr!(mr)!=m!r!(mr)!=(mr) as required.