Solution:
By substituting x=y we obtain v2(f(x))=v2(x). If v2(a)=k>0, by considering the function g(x)=f(2kx)/2k we reduce the claim to the case of odd a. Therefore, from now on we assume that 2∤a.
Note that, if x≡y(mod2k), then f(x)≡f(y)(mod2k). Indeed, if z≡−x(mod2k), then 2k∤z+y, so f(y)≡−f(z)≡f(x)(mod2k). From this it also follows that the function f is injective.
Let 2k−1<3a<2k, where k∈N. Since f(1),f(3),…,f(2k−1) are mutually distinct modulo 2k, there exists an odd number x<2k such that f(x)≡3a (mod2k). Suppose that f(x)=3a. Then f(x)>2k, so from f(x)+ f(2k−x)≡2k(mod2k+1) it follows that f(x)+f(2k−x)⩾3⋅2k. However, on the other hand f(x)+f(2k−x)⩽3(x+(2k−x))=3⋅2k, so this is possible only if f(x)=3x. From this x≡a(mod2k), so x=a, i.e. again f(x)=3a.