Discrete Solutions
Discrete Solutions
1. For lunch, Lamy, Botan, Nene, and Polka each choose one of three options: a hot dog, a slice of
pizza, or a hamburger. Lamy and Botan choose different items, and Nene and Polka choose the
same item. In how many ways could they choose their items?
Answer: 18
Solution: There are 3 ways for Lamy to choose an item. After that, there are 2 ways for Botan
to choose a different item from Lamy. Then there are 3 ways for Nene to choose an item, and
after that there is just 1 way for Polka to choose the same item as Nene. The number of ways
for them to choose the items is 3 · 2 · 3 · 1 = 18 .
2. Compute the number of positive integer divisors of 100000 which do not contain the digit 0.
Answer: 11
Solution: Note that 100000 = 25 · 55 . Any multiple of 10 ends in a 0, so a divisor of 25 · 55
that does not contain a 0 is either not divisible by 2 or not divisible by 5. We consider the cases
separately.
• A divisor of 25 · 55 that is not divisible by 5 will not contain the prime factor 5, and thus it
is either 1 or only contains the prime factor 2, so it must be a power of 2. The powers of 2
up to 25 are 1, 2, 4, 8, 16, and 32.
• A divisor of 25 · 55 that is not divisible by 2 will not contain the prime factor 2, so it is
either 1 or only contains the prime factor 5, and thus it must be a power of 5. The powers
of 5 up to 55 are 1, 5, 25, 125, 625, and 3125.
Since 1 appears in both lists, the total number of divisors of 25 · 55 that do not contain a 0 is
6 + 6 − 1 = 11 .
3. Katie and Allie are playing a game. Katie rolls two fair six-sided dice and Allie flips two fair
two-sided coins. Katie’s score is equal to the sum of the numbers on the top of the dice. Allie’s
score is the product of the values of two coins, where heads is worth 4 and tails is worth 2. What
is the probability Katie’s score is strictly greater than Allie’s?
25
Answer: 72
Solution: Allie’s score is 16 with probability 14 , 8 with probability 21 , or 4 with probability 14 .
2·10+30 25
In total, the probability Katie’s score is (strictly) greater than Allie’s is 62 ·22
= .
72
4. Richard and Shreyas are arm wrestling against each other. They will play 10 rounds, and in each
round, there is exactly one winner. If the same person wins in consecutive rounds, these rounds
are considered part of the same “streak”. How many possible outcomes are there in which there
are strictly more than 3 streaks? For example, if we denote Richard winning by R and Shreyas
winning by S, SSRSSRRRRR is one such outcome, with 4 streaks.
Answer: 932
BMT 2022 Discrete Test Solutions November 5, 2022
Solution: The total number of possible outcomes is 210 = 1024 because there are two possibil-
ities of the winner for each of 10 rounds. Next, let us find the amount of outcomes with 3 or
fewer streaks.
Fix some k ∈ {1, 2, 3}; we compute the number of outcomes with exactly k streaks. For there
to be k streaks, one first has to find k − 1 places in which two consecutive games have different
winners, as these are the places where a new streak starts. This will then divide the 10 games
into k streaks. There are 9 places at which this can occur, because this cannot happen before
9
the first game or after the last game. Thus, there are k−1 ways to choose the places where
a new streak starts. (Note this logic also works for the 1-streak case, in which the winner
never changes.) Then, there are 2 choices for the winner in the first streak; this then uniquely
determines the winners in the remaining games. So, there are
9
2
k−1
total outcomes in which there are k streaks. Summing over each k ∈ {1, 2, 3}, there are
9 9 9
2 +2 +2 = 2 + 18 + 72 = 92
0 1 2
outcomes with 3 or fewer streaks. Subtracting from the total, there are 1024 − 92 = 932
outcomes with strictly more than 3 streaks.
5. Given a positive integer n, let s(n) denote the sum of the digits of n. Compute the largest
positive integer n such that n = s(n)2 + 2s(n) − 2.
Answer: 397
Solution: Let d denote the number of digits in n. Note that we cannot have d ≥ 5: because
s(n) ≤ 9d, we must have
10d−1 ≤ n ≤ (9d)2 + 2 · 9d − 2.
In particular, 105−1 > (9 · 5)2 + 2 · 9 · 5 − 2, with the left-hand side increasing much faster than
the right-hand side, so d ≥ 5 do not satisfy the condition.
Additionally, we cannot have d = 4. Because n ≤ (9 · 4)2 + 2(9 · 4) − 2 < 1400, we have
s(n) ≤ 1 + 3 + 9 + 9 = 22, so
n ≤ 222 + 2 · 22 − 2 < 1000.
Therefore, n has at most 3 digits, so s(n) ≤ 9 · 3 = 27. Now, observe that
so (n − 1)2 ≡ 0 (mod 3), and thus n ≡ 1 (mod 3). We now do casework on s(n).
6. Bayus has eight slips of paper, which are labeled 1, 2, 4, 8, 16, 32, 64, and 128. Uniformly at
random, he draws three slips with replacement; suppose the three slips he draws are labeled a,
b, and c. What is the probability that Bayus can form a quadratic polynomial with coefficients
a, b, and c, in some order, with 2 distinct real roots?
111
Answer: 128
Solution: We compute the complement: namely, we compute the probability that regardless of
the ordering of a, b, and c, no quadratic Bayus makes will have 2 distinct real roots. For this to
be the case, it is sufficient that the largest possible discriminant is nonpositive. Without loss of
generality, assume b = max(a, b, c), so that the largest possible discriminant is b2 − 4ac. Now,
let x = log2 a, y = log2 b, and z = log2 c, so that x, y, z are integers satisfying y = max(x, y, z).
Then
0 ≥ b2 − 4ac = 22y − 4 · 2x · 2z ,
so
x + z + 2 ≥ 2y ≥ x + z.
Thus, x + z ∈ {2y, 2y − 1, 2y − 2}, so the unordered pair {x, z} is one of {y, y}, {y, y − 1},
{y, y − 2}, or {y − 1, y − 1}.
Now, we lift our assumption that y = max(x, y, z) to compute the answer. We have four cases.
• Suppose (x, y, z) is some ordering of (t, t, t). There are 8 such ordered triples.
• Suppose (x, y, z) is some ordering of (t, t, t − 1). There are 3 · 7 = 21 such ordered triples.
• Suppose (x, y, z) is some ordering of (t, t−1, t−1). There are 3·7 = 21 such ordered triples.
• Suppose (x, y, z) is some ordering of (t, t, t − 2). There are 3 · 6 = 18 such ordered triples.
8+21+21+18 111
Subtracting, the probability is 1 − 83
= .
128
7. Luke the frog has a standard deck of 52 cards shuffled uniformly at random placed face down
on a table. The deck contains four aces and four kings (no card is both an ace and a king). He
now begins to flip over the cards one by one, leaving a card face up once he has flipped it over.
He continues until the set of cards he has flipped over contains at least one ace and at least one
king, at which point he stops. What is the expected value of the number of cards he flips over?
689
Answer: 45
Solution: Let’s first compute the expected number of cards until Luke flips over an ace. Note
that we can view this situation as computing the expected position of the first ace in a random
permutation of the 52 cards. Each permutation is of the form
A A A A ,
where the As are aces and the blanks refer to the cards between the aces. For each of the 52 − 4
cards other than the aces, it will be in each of the 5 gaps with equal probability, so there is a
1
5 probability that it is before the first ace. Thus, by Linearity of Expectation, the expected
number of cards up to and including the first ace is 52−4 53
5 + 1 = 5 . Similarly, the expected
53
number of cards to flip over the first king is also 5 .
We now return to the original problem. Let the random variable A be the number of cards
needed to flip over until Luke sees the first ace, and define K similarly for the first king. Our
BMT 2022 Discrete Test Solutions November 5, 2022
answer is E[max(A, K)]. Now, we recall the property max(a, b) = a + b − min(a, b), so again by
Linearity of Expectation,
We have already calculated E[A] = E[K] = 53 5 . The last term is calculated analogously with 8
dividers (for kings and aces) instead of 4, giving us a value of 52−8 53
9 + 1 = 9 . Thus, our answer
689
is 53 53 53
5 + 5 − 9 = 45 .
In particular, we have
(an , bn ) = (3ι + σ)◦n (3, 1),
where f ◦n denotes the n-fold application of f .
Continuing, because ι ◦ σ = σ = σ ◦ ι, we can extend the fact that (a + b)p ≡ ap + bp (mod p)
to our context: by the binomial theorem,
p
◦p
X p
(3ι + σ) = (3ι)◦k σ ◦(p−k) ≡ (3ι)◦p + σ ◦p (mod p).
k
k=0
Now, we can compute (3ι)◦p = 3p ι ≡ 3ι (mod p), and σ ◦2 = −ι so that σ ◦p = σ ◦3 = −σ. Thus,
Thus, (ap+1 , bp+1 ) ≡ (10ι)(3, 1) ≡ (30, 10) (mod p), so the answer is 30 · 100 + 10 = 3010 .
Solution 2: Fix notation as in the first paragraph of the previous solution. This time around,
we compute (3ι + σ)◦32 by force, using repeated squarings. We have the following computations;
all equivalences are (mod 31).
Thus, as before we have (a32 , b32 ) ≡ (30, 10) (mod 31), so the answer is 30 · 100 + 10 = 3010 .
BMT 2022 Discrete Test Solutions November 5, 2022
9. Lysithea and Felix each have a take-out box, and they want to select among 42 different types
of sweets to put in their boxes. They each select an even number of sweets (possibly 0) to put
in their box. In each box, there is at most one sweet of any type, although the boxes may have
sweets of the same type in common. The total number of sweets they take out is 42. Let N
be the number of ways can they select sweets to take out. Compute the remainder when N is
divided by 422 − 1.
Answer: 1355
Solution 1: A nice way to find N , the number of ways, is to use generating functions. For
generality, let n = 21. The number of ways
Pn to 2nput each even number of sweets in a box can be
represented by the generating function i=0 2i x , where the coefficient of xa is the number
2i
of ways to put a sweets in the box. Using the roots of unity filter, we can rewrite this as:
2n 2n
!
(1 + x)2n + (1 − x)2n
1 X 2n i X 2n i
x + (−x) = .
2 i i 2
i=0 i=0
To add the sweets in the two boxes together, we multiply their generating functions together.
That is, the generating function representing the sweets in both boxes is
2 2n
(1 + x)2n + (1 − x)2n (1 + x)4n + 2 1 − x2 + (1 − x)4n
= .
2 4
The coefficient of x2n in this generating function is the number of ways in which the total number
of sweets is 2n. Using the binomial expansions, this coefficient is
4n n 2n + 4n 4n n 2n
2n + 2(−1) n 2n 2n + (−1) n
= .
4 2
Plugging in n = 21 gives N = 21 84 42
42 − 21 .
To find the remainder when N is divided by 422 − 1 = 41 · 43, we note that 41 and 43 are
primes, so by the Chinese Remainder Theorem we can compute the residues modulo 41 and
43 separately and
combine them at the end. For convenience, we will calculate the residues of
2N = 84 42
42 − 21 .
Now we combine 2N ≡ 4 (mod 41) and 2N ≡ 1 (mod 43) by the Chinese Remainder Theorem
and obtain 2N ≡ 947 (mod 41 · 43). Finally, multiplying both sides by 2−1 (namely, we add
41 · 43 to the right side and divide by 2) gives N ≡ 1355 (mod 41 · 43).
Solution 2: It is possible to use a direct counting argument using bijections. Again for gener-
ality, let n = 21. Number the types of sweets from 1 to 2n, and let the sets of sweets in the two
boxes be A and B. We will consider all combinations of sets A, B for which |A| + |B| = 2n. Let
us define a function ϕ(A, B) as follows: find the sweet of largest value that is present in one box
and not the other, and switch the sweet between the boxes. Note that this operation is defined
over all sets A, B for which |A| + |B| = 2n and A ̸= B (if A = B, then there is no sweet that is
present in one box and not the other), and that the cardinalities of |A| and |B| change when ϕ is
applied. Furthermore, ϕ(ϕ(A, B)) = (A, B) since we just switch one sweet back and forth, so ϕ
is a bijection over the sets in which it is defined, which are all sets A, B for which |A| + |B| = 2n
and A ̸= B.
Note that the number of sets A, B for which |A| + |B| = 2n is 4n
2n , since both count the
number of ways to create a set of 2n hats out of 2n blue hats and 2n red hats. There are 2n
n
combinations of sets A, B such that A = B, so there are 4n 2n
2n − n combinations of sets A,
B such that A ̸= B. Among the combinations of sets for which A ̸= B, since a bijection ϕ
exists between combinations for which |A| and |B| are even and those for which |A| and2n|B|
are
1 4n
odd, the number of combinations of sets for which |A| and |B| are even is 2 2n − n . So
the general formula for the number of ways to select the sweets to take out is 12 4n − 2n
2n n
if n is odd, and 21 4n − 2n + 2n = 12 4n + 2n
2n n n 2n n if n is even. Plugging in n = 21 gives
1 84 42
N = 2 42 − 21 , and the answer extraction proceeds in the same way.
10. Compute the number of integer ordered pairs (a, b) such that 10! is a multiple of a2 + b2 .
Answer: 648
Solution: The main idea here is to work in the complex numbers. Indeed, define Z[i] = {a + bi :
a, b ∈ Z}, so we see that a2 + b2 | 10! if and only if α = a + bi has
αα | 10!,
where α denotes the complex conjugate. This has the advantage of being a multiplicative
divisible condition instead of an additive one, so we will spend the rest of the problem counting
the number of possible α ∈ Z[i] such that αα | 10!.
We see that we now want to factor 10! in Z[i]. To start, we factor 10! in Z by using de Polignac’s
formula, writing
10! = 25+2+1 · 33+1 · 52 · 7 = 28 · 34 · 52 · 7.
BMT 2022 Discrete Test Solutions November 5, 2022
We can factor some of these further in Z[i]: namely, 2 = (1 + i)(1 − i) = −i(1 + i)2 and
5 = (2 + i)(2 − i). This gives the factorization
It is known but can be checked by hand that all factors above are actually primes in Z[i], so we
have found our prime factorization of 10! in Z[i].
Now, to finish, we need to divide our given factorization between α and α to give αα | 10!. We
count the number of possible prime factorizations of α | 10!.
In total, there are 9 · 3 · 6 = 162 total prime factorizations of α. However, this is not the number
of possible elements α because we can add a power of i to the prime factorizations to get different
elements. There are four such available powers of i, so there are 4 · 162 = 648 total possible
elements α.