Skip to main content
OlympiadHQ

Browse · MathNet

Print

Silk Road Mathematics Competition

number theory

Problem

The numbers , , , , are written on the board (here listed all prime numbers from the segment ). By operation of simplification we call a changing of two numbers , by maximal prime number not exceeding . At the beginning student removes the number , , and then repeats the simplification operation until the board contains at least two numbers. Find the maximal and minimal possible values of the number which he obtain at the end. How these values depend on ?
Solution
Note that if . That's why simplification of two successive prime numbers is equivalent to removing the maximal (from that two) number. If between prime numbers there is exactly one prime number , then operation of simplification to pair gives or . Hence, the "hole" between and can vanish or move down to one "step".

The maximal possible value is , and this value doesn't depend on first removed number . The algorithm of getting this number can be described as a repeating the operation of simplification to the maximal numbers of the set, except the number . Before the last operation board will have a pair , or , . And last simplification gives .

Algorithm of getting the minimal number can be described as a repeating the operation of simplification to the maximal numbers of the set. If the "hole" obtained by removing the number disappear at some step, then we get the minimal number , else .

It is easy to see that the "hole" vanishes if . In that case the minimal number is equal to . On the other hand, if then easy analysis shows that it vanishes for all steps of student; in this case, the minimal number is equal to .
Final answer
Maximum: 1999, independent of the initial removal. Minimum: 2 if the removed prime q ≥ 17; otherwise 3 for q ∈ {3, 5, 7, 11, 13}.

Techniques

Prime numbersGames / greedy algorithmsInvariants / monovariantsLinear and quadratic inequalities