# Find all functions ff such that if a+ba+b is a square, then f(a)+f(b)f(a)+f(b) is a square

Question:

For any $a,b\in \mathbb{N}^{+}$, if $a+b$ is a square number, then $f(a)+f(b)$ is also a square number. Find all such functions.

My try: It is clear that the function
satisfies the given conditions, since:

But is it the only function that fits our needs?

It’s one of my friends that gave me this problem, maybe this is a Mathematical olympiad problem. Thank you for you help.

It’s not a complete answer, but as mentioned in comments, this problem probably missed some restrictions, and so have too many solutions. Thus I decided to answer this question for the case that $f$ have constant value in infinite (or finite by little changes) partition of $\mathbb N$.
I expect another answers for remained cases e.g when $f$ is an increasing function (polynomial case mentioned in comments).
Let $A$ is an infinite subset of $\mathbb N$, not containing two numbers with square sum (like https://oeis.org/A203988 except elements of the form $\frac{(2k)^2}{2}$ in this sequence) and $A'=\mathbb N -A$ . Suppose $A_1,A_2,...$ is an infinite non-empty partition of $A$, now $f$ could be defined as below
where $k$ and $a_i \in \mathbb N$ .
Now if $x,y \in \mathbb N$ and $x+y$ is a perfect square, then both of $x$ and $y$ should be contained in $A'$, or on of them is in $A'$ and another one is in $A$ (and so contained in one of the $A_i$), in both cases $f(x)+f(y)$ is a perfect square .