Problem

Source: Bulgaria EGMO 2023 TST, Day 1, Problem 2

Tags: number theory, greatest common divisor, function



Determine all integers $k$ for which there exists a function $f: \mathbb{Z}_{>0} \to \mathbb{Z}$ such that $f(2023) = 2024$ and $f(ab) = f(a) + f(b) + kf(\gcd(a,b))$ for all positive integers $a$ and $b$.