Daily

Random

Practice set

Baltic Way 2023 · Problem 8

Combinatorics

In the city of Flensburg there is a single, infinitely long, street with houses numbered 2, 3, .. The police in Flensburg is trying to catch a thief who every night moves from the house where she is currently hiding to one of its neighbouring houses.

To taunt the local law enforcement the thief reveals every morning the highest prime divisor of the number of the house she has moved to.

Every Sunday afternoon the police searches a single house, and they catch the thief if they search the house she is currently occupying. Does the police have a strategy to catch the thief in finite time?

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Algorithms and processes · Induction and recursion · Pigeonhole and extremal arguments

Solutions

Solution

We will prove that the police are always able to catch the thief in finite time. Let hih_i denote the house the thief stays at the ii-th night and pip_i denote the greatest prime divisor of hih_i. The police know that he stays at different neighbouring houses every night, so ∣hi+1−hi∣=1|h_{i+1} - h_i| = 1 for all non-negative integers ii. Let us assume that the police are given the address of the thief's first two hiding spots, then we will prove by induction that the police can determine hih_i precisely except being unable to distinguish between houses numbered 22 and 44.

Assume the police knows hi−2h_{i-2} and hi−1h_{i-1}, then they know that hi=hi−2h_i = h_{i-2} or hi=2hi−1−hi−2h_i = 2h_{i-1} - h_{i-2}. In the first case they will receive pi=pi−2p_i = p_{i-2} and in the latter case they will receive pip_i as the biggest prime divisor of 2hi−1−hi−22h_{i-1} - h_{i-2}. Assume that they are unable to distinguish between these two cases, i.e., that pi=pi−2p_i = p_{i-2}, which implies

pi−2∣2hi−1−hi−2, i.e. pi−2∣2hi−1, i.e. pi−2∣2, i.e. pi−2=2p_{i-2} \mid 2h_{i-1} - h_{i-2}, \text{ i.e. } p_{i-2} \mid 2h_{i-1}, \text{ i.e. } p_{i-2} \mid 2, \text{ i.e. } p_{i-2} = 2

since ∣hi−1−hi−2∣=1|h_{i-1} - h_{i-2}| = 1 implies gcd⁡(hi−1,hi−2)=1\gcd(h_{i-1}, h_{i-2}) = 1. Moreover, since pi=pi−2=2p_i = p_{i-2} = 2 are the biggest prime divisors of hi=2hi−1−hi−2h_i = 2h_{i-1} - h_{i-2} and hi−2h_{i-2} they must both be powers of 22. However, the only powers of two with a difference of exactly 22 are 22 and 44. Hence {hi−2,2hi−1−hi−2}={2,4}\{h_{i-2}, 2h_{i-1} - h_{i-2}\} = \{2, 4\}, i.e. hi−1=2+42=3h_{i-1} = \frac{2+4}{2} = 3.

Thus, either the police will with certainty be able to determine hih_i or hi−1=3h_{i-1} = 3, in which case hih_i may equal either 22 or 44. To complete the inductive step we observe that the police are always able to determine the parity of hjh_j, since it changes every day. Thus, in the future if the police know that hj∈[2,4]h_j \in [2, 4], then they can either determine hj=3h_j = 3 or hj∈{2,4}h_j \in \{2, 4\}. However, the only way for the thief to leave the interval [2,4][2, 4] is to go to house number 55, in which case the police will be alerted by receiving pj=5p_j = 5, and they can again with certainty determine hj=5h_j = 5 and hj−1=4h_{j-1} = 4 preserving our inductive hypothesis.

To summarize, if the police knows both h0h_0 and h1h_1, then they can always determine hih_i with certainty until hi−1=3h_{i-1} = 3. After this point they will have known the two last hiding places of the thief if he leaves the interval [2,4][2, 4], restoring the inductive hypothesis, or otherwise, if he never leaves [2,4][2, 4] be able to determine his position, up to confusion about 22 and 44 using the parity of the day.

Now, to catch the thief in finite time, they may methodically try to guess all viable pairs of (h0,h1)(h_0, h_1), i.e. h0,h1∈N≥2h_0, h_1 \in \mathbb{N}_{\ge 2} and ∣h0−h1∣=1|h_0 - h_1| = 1, of which there are countably many. For each viable starting position, let us consider either the immediate Sunday or the one after that, since each week has an odd amount of days, we are certain that exactly one of these days gives us that the thief is hiding in an odd house (given our assumption on his starting position). Thus, due to our inductive hypothesis, we can precisely determine where the thief will be, and search this house. If the thief is hiding in that house, the police wins, and if not, they will with certainty know that their guess of starting positions was incorrect, and move onto the next guess. By the above argument, each guess of initial starting positions requires at most two weeks, meaning that the police will catch the thief in finite time.

Contest context

Results from Baltic Way 2023

10 teams

Mean score
2.2 / 5
Scores of 4 or 5
4 / 10
Estonia
0 / 5

Score distribution

04
11
20
31
42
52
All team scores
TeamScore
Germany5 / 5
Sweden1 / 5
Lithuania4 / 5
Poland5 / 5
Estonia0 / 5
Latvia0 / 5
Norway3 / 5
Denmark4 / 5
Finland0 / 5
Iceland0 / 5