Suppose that the statement is false and f(R)=N. We prove several properties of the function f in order to reach a contradiction.
To start with, observe that one can assume f(0)=1. Indeed, let a∈R be such that f(a)=1, and consider the function g(x)=f(x+a). By substituting x+a and y+a for x and y in (1), we have
g(x+g(y)1)=f(x+a+f(y+a)1)=f(y+a+f(x+a)1)=g(y+g(x)1).
So g satisfies the functional equation (1), with the additional property g(0)=1. Also, g and f have the same set of values: g(R)=f(R)=N. Henceforth we assume f(0)=1.
Claim 1. For an arbitrary fixed c∈R we have {f(c+n1):n∈N}=N.
Proof. Equation (1) and f(R)=N imply
f(R)={f(x+f(c)1):x∈R}={f(c+f(x)1):x∈R}⊂{f(c+n1):n∈N}⊂f(R).
The claim follows.
We will use Claim 1 in the special cases c=0 and c=1/3 :
{f(n1):n∈N}={f(31+n1):n∈N}=N.
Claim 2. If f(u)=f(v) for some u,v∈R then f(u+q)=f(v+q) for all nonnegative rational q. Furthermore, if f(q)=1 for some nonnegative rational q then f(kq)=1 for all k∈N.
Proof. For all x∈R we have by (1)
f(u+f(x)1)=f(x+f(u)1)=f(x+f(v)1)=f(v+f(x)1)
Since f(x) attains all positive integer values, this yields f(u+1/n)=f(v+1/n) for all n∈N. Let q=k/n be a positive rational number. Then k repetitions of the last step yield
f(u+q)=f(u+nk)=f(v+nk)=f(v+q)
Now let f(q)=1 for some nonnegative rational q, and let k∈N. As f(0)=1, the previous conclusion yields successively f(q)=f(2q),f(2q)=f(3q),…,f((k−1)q)=f(kq), as needed.
Claim 3. The equality f(q)=f(q+1) holds for all nonnegative rational q.
Proof. Let m be a positive integer such that f(1/m)=1. Such an m exists by (2). Applying the second statement of Claim 2 with q=1/m and k=m yields f(1)=1.
Given that f(0)=f(1)=1, the first statement of Claim 2 implies f(q)=f(q+1) for all nonnegative rational q.
Claim 4. The equality f(n1)=n holds for every n∈N.
Proof. For a nonnegative rational q we set x=q,y=0 in (1) and use Claim 3 to obtain
f(f(q)1)=f(q+f(0)1)=f(q+1)=f(q).
By (2), for each n∈N there exists a k∈N such that f(1/k)=n. Applying the last equation with q=1/k, we have
n=f(k1)=f(f(1/k)1)=f(n1).
Now we are ready to obtain a contradiction. Let n∈N be such that f(1/3+1/n)=1. Such an n exists by (2). Let 1/3+1/n=s/t, where s,t∈N are coprime. Observe that t>1 as 1/3+1/n is not an integer. Choose k,l∈N so that that ks−lt=1.
Because f(0)=f(s/t)=1, Claim 2 implies f(ks/t)=1. Now f(ks/t)=f(1/t+l); on the other hand f(1/t+l)=f(1/t) by l successive applications of Claim 3. Finally, f(1/t)=t by Claim 4, leading to the impossible t=1. The solution is complete.