Let us try to find all functions f:Z→N such that:
i) f(m+n)=f(m)+f(n)+2mn for all m,n∈Z;
ii) f(f(x))−f(1) is a perfect square for all x∈Z.
Let us first solve the functional equation (i).
Let P(m,n) denote the assertion f(m+n)=f(m)+f(n)+2mn.
Let us try to find the general form of f.
Let us try f(x)=ax2+bx+c for some a,b,c∈R.
Plug into (i):
f(m+n)=a(m+n)2+b(m+n)+c
f(m)+f(n)+2mn=am2+bm+c+an2+bn+c+2mn
=a(m2+n2)+b(m+n)+2c+2mn
But a(m+n)2=a(m2+2mn+n2)=am2+2amn+an2
So:
f(m+n)=am2+2amn+an2+bm+bn+c
Set equal to a(m2+n2)+b(m+n)+2c+2mn:
am2+2amn+an2+bm+bn+c=am2+an2+bm+bn+2c+2mn
2amn+c=2mn+2c
2amn+c=2mn+2c
2amn−2mn=2c−c
2(a−1)mn=c
But this must hold for all m,n, so a=1 and c=0.
Therefore, f(x)=x2+bx for some b∈R.
But f:Z→N, so f(x)=x2+bx must be a positive integer for all x∈Z.
Let us check for which b this is possible.
For x=0, f(0)=0.
But N usually means positive integers, i.e., N={1,2,3,…}, so f(0)=0 is not in N.
Therefore, there is no such function unless N is defined to include 0 (some conventions do this, but usually N is positive integers).
Alternatively, perhaps the problem means N0={0,1,2,…}.
Let us proceed anyway.
For x=−b, f(−b)=(−b)2+b(−b)=b2−b2=0.
So f(−b)=0.
Thus, unless b=0, f(x) takes the value 0 for some x.
If b=0, f(x)=x2, which is always non-negative, and f(0)=0.
So f(x)=x2 is a solution if 0∈N.
If N is positive integers, then there is no solution.
Let us check the second condition for f(x)=x2:
f(f(x))−f(1)=f(x2)−12=(x2)2−1=x4−1
Is x4−1 always a perfect square?
For x=0, 04−1=−1, not a perfect square.
For x=1, 14−1=0, which is a perfect square.
For x=2, 16−1=15, not a perfect square.
So f(x)=x2 does not satisfy the second condition.
Let us try b=1, f(x)=x2+x.
Then f(0)=0, f(−1)=1−1=0.
So again, f(x) takes value 0.
Let us try b=2, f(x)=x2+2x.
Then f(0)=0, f(−2)=4−4=0.
So for any integer b, f(x) takes value 0 at x=0 or x=−b.
Therefore, unless 0∈N, there is no solution.
If 0∈N, let us check the second condition for f(x)=x2+bx.
f(f(x))−f(1)=f(x2+bx)−(12+b⋅1)=(x2+bx)2+b(x2+bx)−(1+b)
=(x4+2bx3+b2x2)+bx2+b2x−(1+b)
=x4+2bx3+(b2+b)x2+b2x−(1+b)
Is this always a perfect square for all x?
For x=0, f(f(0))−f(1)=f(0)−f(1)=0−(1+b)=−(1+b), which is negative unless b=−1.
But for b=−1, f(x)=x2−x, f(0)=0, f(1)=1−1=0, f(f(0))−f(1)=0−0=0, which is a perfect square.
Check f(f(2))−f(1):
f(2)=4−2=2
f(f(2))=f(2)=2
f(1)=0
So f(f(2))−f(1)=2−0=2, not a perfect square.
So b=−1 does not work.
Therefore, there is no function f:Z→N of the form x2+bx that satisfies both conditions.
Therefore, there is no function f:Z→N satisfying both conditions, unless N includes 0 and f(1)=1.
But in all cases, the second condition fails for some x.
Therefore, the answer is:
There is no function f:Z→N satisfying both conditions.