Problem

Source: IMO Shortlist 2017 N8

Tags: IMO Shortlist, number theory, Euclidean algorithm



Let $p$ be an odd prime number and $\mathbb{Z}_{>0}$ be the set of positive integers. Suppose that a function $f:\mathbb{Z}_{>0}\times\mathbb{Z}_{>0}\to\{0,1\}$ satisfies the following properties: $f(1,1)=0$. $f(a,b)+f(b,a)=1$ for any pair of relatively prime positive integers $(a,b)$ not both equal to 1; $f(a+b,b)=f(a,b)$ for any pair of relatively prime positive integers $(a,b)$. Prove that $$\sum_{n=1}^{p-1}f(n^2,p) \geqslant \sqrt{2p}-2.$$