Daily

Random

Practice set

Baltic Way 2025 · Problem 19

Number Theory

There are 100 positive integers written on a blackboard. Anna plays a game. A move consists of choosing two integers aa and bb on the blackboard with the property that a∣ba\mid b, erasing them both and writing the integer b/ab/a. She makes moves until there are no more valid moves, at which point the game ends.

Find the largest NN such that for some initial state Anna can both:

  • finish the game with only one number remaining, and
  • finish the game with NN numbers remaining.
Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Divisibility and factorization

Solutions

Solution

The answer is N=99N=99.

We solve the more general problem with n≥5n\ge5 integers on the blackboard.

Since Anna can reach a state with one integer on the board, there must be a valid first move. Hence a terminal state obtained from the same initial position can contain at most n−1n-1 numbers, so

N≤n−1.N\le n-1.

For the reverse inequality, let q,p1,…,pn−2q,p_1,\ldots,p_{n-2} be distinct primes and put on the board

qp1, p1, p1p2, p2p3,…, pn−3pn−2, pn−2p1.qp_1, \ p_1, \ p_1p_2, \ p_2p_3, \ldots, \ p_{n-3}p_{n-2}, \ p_{n-2}p_1.

On the one hand, Anna can make the moves

(p1,p1p2)↦p2,(p2,p2p3)↦p3,…,(pn−2,pn−2p1)↦p1,(p1,qp1)↦q,(p_1,p_1p_2)\mapsto p_2, \quad (p_2,p_2p_3)\mapsto p_3, \quad\ldots\quad, (p_{n-2},p_{n-2}p_1)\mapsto p_1, \quad (p_1,qp_1)\mapsto q,

after which only qq remains on the board.

On the other hand, Anna can instead begin with

(p1,qp1)↦q.(p_1,qp_1)\mapsto q.

The remaining numbers are

q, p1p2,…, pn−3pn−2, pn−2p1,q, \ p_1p_2, \ldots, \ p_{n-3}p_{n-2}, \ p_{n-2}p_1,

and none of them divides another. Thus the game ends with n−1n-1 numbers. Therefore the maximum in the general problem is n−1n-1, and for n=100n=100 we get

N=99.N=99.

Remark. There are other constructions. For example, let q,p1,…,pn−2q,p_1,\ldots,p_{n-2} again be distinct primes and start with

qp1, qp2,…, qpn−2, qn−3, qn−3p1p2⋯pn−2.qp_1, \ qp_2, \ldots, \ qp_{n-2}, \ q^{n-3}, \ q^{n-3}p_1p_2\cdots p_{n-2}.

One possible sequence of moves is

(qp1,qn−3p1p2⋯pn−2)↦qn−4p2⋯pn−2,(qp_1,q^{n-3}p_1p_2\cdots p_{n-2}) \mapsto q^{n-4}p_2\cdots p_{n-2}, (qp2,qn−4p2⋯pn−2)↦qn−5p3⋯pn−2,(qp_2,q^{n-4}p_2\cdots p_{n-2}) \mapsto q^{n-5}p_3\cdots p_{n-2},

continuing in this way until

(qpn−3,qpn−3pn−2)↦pn−2,(qp_{n-3},qp_{n-3}p_{n-2})\mapsto p_{n-2},

then

(pn−2,qpn−2)↦q,(q,qn−3)↦qn−4.(p_{n-2},qp_{n-2})\mapsto q, \qquad (q,q^{n-3})\mapsto q^{n-4}.

Only qn−4q^{n-4} remains.

On the other hand, Anna can make the single move

(qn−3,qn−3p1p2⋯pn−2)↦p1p2⋯pn−2.(q^{n-3},q^{n-3}p_1p_2\cdots p_{n-2}) \mapsto p_1p_2\cdots p_{n-2}.

The numbers then left on the board are

qp1, qp2,…, qpn−2, p1p2⋯pn−2,qp_1, \ qp_2, \ldots, \ qp_{n-2}, \ p_1p_2\cdots p_{n-2},

none of which divides another.

Contest context

Results from Baltic Way 2025

11 teams

Mean score
4.1 / 5
Scores of 4 or 5
9 / 11
Estonia
5 / 5

Score distribution

02
10
20
30
40
59
All team scores
TeamScore
Germany5 / 5
Estonia5 / 5
Poland5 / 5
Lithuania5 / 5
Norway5 / 5
Latvia0 / 5
Finland5 / 5
Denmark5 / 5
Sweden5 / 5
Ukraine5 / 5
Iceland0 / 5