113

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 $$f(x)=x$$ satisfies the given conditions, since: $$f(a)+f(b)=a+b.$$

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.

math110
  • 94,932
  • 17
  • 148
  • 519
  • 23
    Well, for each $k \in \mathbb N^+$ there is the function $f(x) = k^2x$. – TonyK Apr 28 '14 at 11:35
  • 5
    Also, the constant function $f(x)=2k^2$. – Chris Culter Sep 02 '14 at 06:21
  • 5
    @ChrisCulter It should be $f(x) = \frac 12k^2$. – Ben Frankel Oct 10 '14 at 13:38
  • 5
    @BenFrankel Both work... $2k^2 + 2k^2 = (2k)^2$ is a square. – Najib Idrissi Oct 10 '14 at 13:39
  • 2
    @NajibIdrissi Ah, right. It's the same thing then. $\frac 12(2k)^2 = 2k^2$. My suggestion was more general though because for example $\frac 12(3)^2 = 4.5$ is not accounted for with what Chris wrote. – Ben Frankel Oct 10 '14 at 13:40
  • 15
    It is proven that if $f$ is polynomial then $f(n)=a^2n$ or $f(n)=a^2/2$ for some constant $a$; see the article :On the sum-pth-power polynomial by Lwins G – Elaqqad Feb 20 '15 at 21:03
  • Does $\Bbb{N}^+$ contain zero? – Beni Bogosel Apr 09 '15 at 12:18
  • 1
    @Elaqqad: The article you cite proves this only for polynomials, as far as I see. – Beni Bogosel Apr 09 '15 at 12:29
  • 14
    Let $A$ be a subset of $\mathbb{N}^+$ not containing two elements with perfect square sum. For instance, $A$ can be the set of natural numbers of the form $3n+1$. Define $f(n)$ to be $1$ if $n\in A$ and $8$ otherwise. $f$ is a solution. – Mohsen Shahriari Jul 29 '15 at 19:31
  • 10
    A generalization: Let $A$ be like I said. Define $f(n)$ to be $l^2-2k^2$ if $n\in A$ and $2k^2$ otherwise (where of course $2k^2<l^2$). $f$ is a solution. – Mohsen Shahriari Jul 29 '15 at 19:48
  • 4
    In the last comment of mine, note that $l$ doesn't need to be constant and we can choose different $l$'s for different $n$'s. – Mohsen Shahriari Jul 29 '15 at 20:06
  • f(x) = x is the only x related function – Saketh Malyala Aug 28 '15 at 01:01
  • @SakethMalyala Can you explain it in more details and more precisely? – Mohsen Shahriari Sep 25 '15 at 13:33
  • 16
    Perhaps I am being pessimistic, but to me there seem to be far too many solutions, none of which resemble each other in anyway, for this question to be manageable without further restriction - the condition on $f$ as it stands is very weak. To me it feels likely that your friend thought they solved it but missed something, or forgot additional info when they passed on the problem. – ocg Dec 26 '15 at 21:44
  • 2
    @MohsenShahriari Brother, so what you say is basically that, let $$f (n) = \begin {cases}l^2 (n) - 2k^2, \qquad \text{if } n \equiv 1 \pmod {3} \ 2k^2, \qquad \qquad \qquad \text {otherwise} \end {cases}$$ for some function $l (n)$. I think you should write this. –  Jan 20 '16 at 19:33
  • I assume a general approach should be like this: We should find such a function $f: \mathbf {N} \mapsto \mathbf {N}$ that for any natural number $a$ that the expression $$f (a) + f (n^2 - a)$$ be a perfect square. The only polynomial $f (n)$ is $t^2 n$ for any $t \in \mathbf {N}$. –  Jan 20 '16 at 20:01
  • 2
    Developing @MohsenShahriari's comment, for any $A\subset \mathbb{N}$, set $f(x) = 2$, $x\in A$, $f(x) = 98$, $x\notin A$. Then $f(x)+f(y)$ is always a square. Generally, one can take the numbers $2(m^2-n^2 \pm 2mn)^2$ instead of $2$ and $98$. – zhoraster Feb 08 '16 at 09:45
  • @zhoraster Or in a similar vein to (but slightly different from) the Euler brick problem, take any 3-partition of $\mathbb N$ and take $f(x)$ to be constant on each partition with one of the values $15842$, $72962$, $216482$. Probably this won't scale easily to 4 values... :) – Erick Wong Feb 09 '16 at 01:29
  • 2
    The function is $f \colon \mathbb{N}+ \rightarrow \mathbb{N}+$? – marmistrz Feb 29 '16 at 10:13
  • There are constant functions such as $f = 25/2$, but also nonconstant functions such as $f(1) = 25/2$ and $f(n) = 47/2$ for $n > 1$. – Carl Mummert Jan 31 '17 at 15:23
  • If I say there are infinitely many such functions. – Harsh Kumar Apr 05 '17 at 15:48
  • If $G = (\mathbb N_+, R)$ is the (undirected) graph with an edge $(a,b)$ iff $a+b$ is a square, then $f$ has the desired property if and only if $f$ is a graph homomorphism $G\to G$. In particular, $f$ must maps loops (i.e. $(n,n)$ for which $2n$ is a square) to loops, triangles to triangles, and so on. Perhaps this gives rise to some Ideas for restrictions to $f$. – Lukas Juhrich Nov 20 '19 at 02:43

2 Answers2

7

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
$$ f(n) = \begin{cases} a=\frac{(2k)^2}{2}& \quad \text{if } n \in A' \\a_1^2-a & \quad \text{if } n \in A_1\\a_2^2-a & \quad \text{if } n \in A_2\\.\\.\\. \end{cases} $$ 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 .

0

we can find some other solutions such the zero function or the functions under the form $f(n)=a^2n$ or the constant functions under the form $f(n)=\dfrac{a^2}{2}$, or an other function $f$ which can be determined following this method.
Here I am just giving a way to build a function with this property
suppose that $a, b \in \mathbb{N}^{+} $ such that their sum is a perfect square, that is there exists $n \in \mathbb{N}_{≥2}$ such that
$$ a+b=n^2 $$ which is equivalent to
$$ a=n^2-b $$ which implies that
$$ f(a)+f(b)=f(n^2-b)+f(b) $$ then from here we can see that we are looking for a function $f$ such that
$$ \forall n \in \mathbb{N}_{\geq 2}, \forall b \in { 1, 2,..., [ \dfrac{n^2}{2}] }, \exists a(b,n) \in \mathbb{N}; f(n^2-b)+f(b)=(a(b,n))^2$$ Let's start building
for $n=2$ we need to give values to $f(b) $ and $a(b, 2)$ for $ b \in \{ 1, 2 \}$ such that
$$ f(4-b)+f(b)=(a(b,2))^2$$ that is we need to give values to $f(1), f(2), f(3)$ and $a(1, 2), a(2,2)$ such that
$$ \begin{cases} f(3)+f(1)=(a(1,2))^2 \\ f(2)+f(2)=(a(2,2))^2 \end{cases} $$ Then we find that we can associate a random values to $f(1), a(1,2), a(2,2)$ and we define $f(2), f(3)$ as follows
$$ \begin{cases} f(2)=\dfrac{(a(2,2))^2}{2} \\ f(3)=(a(1,2))^2-f(1) \end{cases}$$ before moving to the next step we need to note that if $n$ is even and by taking $ b= \left[ \dfrac{n^2}{2}\right]$ the equality $ f(n^2-b)+f(b)=(a(b,n))^2 $ gives
$$ f( [ \dfrac{n^2}{2}] )=\dfrac{a( [ \dfrac{n^2}{2}], n)^2}{2}...(*) $$ and we can choose any natural value for $a( [ \dfrac{n^2}{2}], n)$ to define $f( [ \dfrac{n^2}{2}] )$.
in the next steps we have to take in account that $f( [ \dfrac{n^2}{2}])$ has been already determined.
for $n=3$ we need to give values to $f(b) $ and $a(b, 2)$ for $ b \in \{ 1, 2, 3, 4\}$ such that
$$ f(9-b)+f(b)=(a(b,3))^2$$ that is $$ \begin{cases} f(8)+f(1)=\dfrac{(a(1,3))^2}{2} \\ f(7)+f(2)=(a(2,3))^2\\ f(6)+f(3)=(a(3,3))^2\\ f(5)+f(4)=(a(4,3))^2 \end{cases}$$ Here we need to see that $f(2)$ and $f(8)$ have been already choosed from the equality $(*) $ that implies that $f(1)$ is not random as we find in the first step so we need to change the choice of $f(1)$ to be under the form $$ f(1)=\dfrac{(a(1,3))^2}{2}-f(8)$$ and since $f(2), f(3)$ are well determined we can easily associate values to $f(7), f(6)$.
but $f(4), f(5)$ remain not determined, it's clear that we can associate a random value to $f(4)$ and then we get $f(5)=(a(4,3))^2-f(4)$, but is this true?
Maybe in the next steps we will need to change one of these values as we have done with $f(1)$, and we iterate counting the next values of the function $f$.