Daily

Random

Practice set

Baltic Way 2025 · Problem 18

Number Theory

Find all functions f:Z>0→Z>0f:\mathbb Z_{>0}\to\mathbb Z_{>0} such that f(2)=1f(2)=1 and

lcm⁡(f(a+b),f(b))∣lcm⁡(a+f(b),b)\operatorname{lcm}(f(a+b),f(b))\mid\operatorname{lcm}(a+f(b),b)

for all positive integers a,ba,b.

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

GCD and LCM · Diophantine equations

Solutions

Solution

The solutions are precisely the functions satisfying

f(x)={1,if x is odd or x=2,1 or 2,otherwise.f(x)= \begin{cases} 1,&\text{if }x\text{ is odd or }x=2,\\ 1\text{ or }2,&\text{otherwise.} \end{cases}

Let P(a,b)P(a,b) denote the assertion of the original divisibility condition. We repeatedly use that lcm⁡(r,s)∣n\operatorname{lcm}(r,s)\mid n implies r∣nr\mid n, and that lcm⁡(n,1)=n\operatorname{lcm}(n,1)=n.

From P(1,1)P(1,1),

lcm⁡(f(2),f(1))∣lcm⁡(1+f(1),1)=1+f(1).\operatorname{lcm}(f(2),f(1))\mid\operatorname{lcm}(1+f(1),1)=1+f(1).

Since f(2)=1f(2)=1, this gives f(1)∣1+f(1)f(1)\mid1+f(1), hence f(1)=1f(1)=1.

From P(a,1)P(a,1) we get

f(a+1)∣a+1,f(a+1)\mid a+1,

so f(n)∣nf(n)\mid n for all positive integers nn.

From P(1,a)P(1,a),

f(a+1)∣lcm⁡(1+f(a),a).f(a+1)\mid\operatorname{lcm}(1+f(a),a).

Because f(a+1)∣a+1f(a+1)\mid a+1, we have gcd⁡(f(a+1),a)=1\gcd(f(a+1),a)=1, and therefore

f(a+1)∣1+f(a).f(a+1)\mid1+f(a).

In particular,

f(a+1)≤1+f(a)≤2+f(a−1)≤⋯≤a−1+f(2)=a.f(a+1)\le1+f(a)\le2+f(a-1)\le\cdots\le a-1+f(2)=a.

Thus whenever the function increases, it increases by at most 11. Consequently, if a value mm is ever attained, all positive values below mm have already been attained at smaller arguments.

We show that the function never takes the value 33. Suppose, to the contrary, that f(a)=3f(a)=3 for the least such aa. Then a≥6a\ge6. Since f(a)≤1+f(a−1)f(a)\le1+f(a-1) and f(a−1)<3f(a-1)<3, we have f(a−1)=2f(a-1)=2.

Now f(a)∣af(a)\mid a gives 3∣a3\mid a, while f(a−1)∣a−1f(a-1)\mid a-1 gives 2∣a−12\mid a-1. Hence a≡3(mod6)a\equiv3\pmod6, so gcd⁡(a−4,6)=1\gcd(a-4,6)=1. Also f(a−4)∣a−4f(a-4)\mid a-4 and, by minimality of aa, f(a−4)<3f(a-4)<3. Therefore f(a−4)=1f(a-4)=1.

Applying P(4,a−4)P(4,a-4) gives

f(a)=3∣lcm⁡(4+f(a−4),f(a−4))=lcm⁡(5,1)=5,f(a)=3\mid\operatorname{lcm}(4+f(a-4),f(a-4)) =\operatorname{lcm}(5,1)=5,

which is impossible. Hence ff never takes the value 33, and therefore it never takes any value at least 33.

Thus f(a)∈{1,2}f(a)\in\{1,2\} for every aa. Since f(a)∣af(a)\mid a, every odd aa must satisfy f(a)=1f(a)=1, and f(2)=1f(2)=1 is given. Conversely, assigning either 11 or 22 independently at every even argument other than 22, while taking value 11 at every odd argument and at 22, satisfies the original condition.

Contest context

Results from Baltic Way 2025

11 teams

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

Score distribution

00
11
21
30
40
59
All team scores
TeamScore
Germany5 / 5
Estonia5 / 5
Poland5 / 5
Lithuania5 / 5
Norway5 / 5
Latvia5 / 5
Finland5 / 5
Denmark5 / 5
Sweden5 / 5
Ukraine2 / 5
Iceland1 / 5