(a) A function $f:\mathbb{Z} \rightarrow \mathbb{Z}$ is called $\mathbb{Z}$-good if $f(a^2+b)=f(b^2+a)$ for all $a, b \in \mathbb{Z}$. What is the largest possible number of distinct values that can occur among $f(1), \ldots, f(2023)$, where $f$ is a $\mathbb{Z}$-good function? (b) A function $f:\mathbb{N} \rightarrow \mathbb{N}$ is called $\mathbb{N}$-good if $f(a^2+b)=f(b^2+a)$ for all $a, b \in \mathbb{N}$. What is the largest possible number of distinct values that can occur among $f(1), \ldots, f(2023)$, where $f$ is a $\mathbb{N}$-good function?
Problem
Source: MEMO 2023 T1
Tags: algebra
25.08.2023 14:18
a_507_bc wrote: (a) A function $f:\mathbb{Z} \rightarrow \mathbb{Z}$ is called $\mathbb{Z}$-good if $f(a^2+b)=f(b^2+a)$ for all $a, b \in \mathbb{Z}$. What is the largest possible number of distinct values that can occur among $f(1), \ldots, f(2023)$, where $f$ is a $\mathbb{Z}$-good function? Let $P(x,y)$ be the assertion $f(x^2+y)=f(x+y^2)$ Subtracting $P(0,-x)$ from $P(0,x)$, we get $f(-x)=f(x)$ Subtracting $P(1,-x-1)$ from $P(1,x+1)$, we get $f(x+2)=f(-x)$ Adding, we get $f(x+2)=f(x)$ And so at most two distinct values for $f(x)$ And since this numbe can indeed be reached (for example with $f(2n)=0$ and $f(2n+1)=1$), we got the answer $\boxed{2}$
28.08.2023 12:01
Here is the solution for part (b): Clearly we are asked about the number of connected components among $1,2,\dots,2023$ in the graph where edges are between $a^2+b$ and $b^2+a$. We claim that each connected component consists of a chain. This is equivalent to saying that each number $n$ has at most one edge to a smaller number. Indeed, note that $a^2+b<b^2+a$ iff $a<b$. Hence, if $n=b^2+a>a^2+b$, then $b>a$ and it is clear that there is at most one representation of $n=b^2+a$ with $b>a$. Indeed, this argument also shows which numbers have an edge to a smaller number, namely those in the interval $[b^2+1,b^2+b-1]$. Conversely, a number is a minimum of a chain iff it is in an interval $[b^2-b,b^2]$ for $b \ge 1$. Now just count: Such an interval has $b+1$ elements, so from $0$ to $2025=45^2$ we get $2+3+\dots+46=24 \cdot 45=1080$ such numbers. Since $0, 2024$ and $2025$ are also minima, we have $1077$ minima among $1,2,\dots,2023$. Since each minimum corresponds to a unique connected component, the answer is therefore $\boxed{1077}$.