Browse · MathNet
PrintJunior Balkan Mathematical Olympiad
North Macedonia counting and probability
Problem
For a positive integer , two players and play the following game: Given a pile of stones, the players take turns alternatively with going first. On each turn the player is allowed to take either one stone, or a prime number of stones, or a multiple of stones. The winner is the one who takes the last stone. Assuming both and play perfectly, for how many values of can player not win?
Solution
Denote by the sought number and let be the corresponding values for . We call each a losing number and every other nonnegative integer a winning number.
(I) Clearly every multiple of is a winning number. Suppose there are two different losing numbers , which are congruent modulo . Then, on his first turn of play, player may remove stones (since ), leaving a pile with stones for . This is in contradiction with both and being losing numbers.
(II) Hence, there are at most losing numbers, i.e. . Suppose there exists an integer , such that is a winning number for every . Let us denote by the greatest losing number (if ) or (if ), and let . Note that all the numbers are composite. Let , be such that . In order for to be a winning number, there must exist an integer , which is either one, or prime, or a positive multiple of , such that is a losing number or , and hence lesser than or equal to . Since , must be a composite, hence is a multiple of (say ). But then must be a winning number, according to our assumption. This contradicts our assumption that all numbers , are winning.
(III) Hence, each nonzero residue class modulo contains a losing number.
(IV) There are exactly losing numbers (one for each residue ).
Similar proof of (III):
Lemma: No pair of positive integers satisfies the following property: () In exists an arithmetic progression with difference such that each segment contains a prime.
Proof of the lemma: Suppose such a pair and a corresponding arithmetic progression exist. In exist arbitrarily long patches of consecutive composites. Take such a patch of length . Then, at least one segment is fully contained in , a contradiction.
Suppose such a nonzero residue class modulo exists (hence ). Let be greater than every losing number. Consider the members of the supposed residue class which are greater than . They form an arithmetic progression with the property (), a contradiction (by the lemma).
(I) Clearly every multiple of is a winning number. Suppose there are two different losing numbers , which are congruent modulo . Then, on his first turn of play, player may remove stones (since ), leaving a pile with stones for . This is in contradiction with both and being losing numbers.
(II) Hence, there are at most losing numbers, i.e. . Suppose there exists an integer , such that is a winning number for every . Let us denote by the greatest losing number (if ) or (if ), and let . Note that all the numbers are composite. Let , be such that . In order for to be a winning number, there must exist an integer , which is either one, or prime, or a positive multiple of , such that is a losing number or , and hence lesser than or equal to . Since , must be a composite, hence is a multiple of (say ). But then must be a winning number, according to our assumption. This contradicts our assumption that all numbers , are winning.
(III) Hence, each nonzero residue class modulo contains a losing number.
(IV) There are exactly losing numbers (one for each residue ).
Similar proof of (III):
Lemma: No pair of positive integers satisfies the following property: () In exists an arithmetic progression with difference such that each segment contains a prime.
Proof of the lemma: Suppose such a pair and a corresponding arithmetic progression exist. In exist arbitrarily long patches of consecutive composites. Take such a patch of length . Then, at least one segment is fully contained in , a contradiction.
Suppose such a nonzero residue class modulo exists (hence ). Let be greater than every losing number. Consider the members of the supposed residue class which are greater than . They form an arithmetic progression with the property (), a contradiction (by the lemma).
Final answer
n - 1
Techniques
Games / greedy algorithmsModular ArithmeticLeast common multiples (lcm)