MathLabs

Problem 3

Find all functions g:Z>0→Z>0g:\mathbb{Z}_{>0}\to\mathbb{Z}_{>0} such that (g(m)+n)(g(n)+m)\left(g(m)+n\right)\left(g(n)+m\right) is a perfect square for all m,n∈Z>0m,n\in\mathbb{Z}_{>0}.
Step 4 of 6: Deduce unit consecutive differences and injectivity
g(k+1)−g(k)∈{−1,1},g(a)=g(b)⟹a=bg(k+1)-g(k)\in\{-1,1\},\qquad g(a)=g(b)\Longrightarrow a=b
Detailed analysis

If g(k)=g(k+1)g(k)=g(k+1), the claim applied modulo any prime pp would give k≡k+1(modp)k\equiv k+1\pmod p, impossible. If ∣g(k+1)−g(k)∣>1|g(k+1)-g(k)|>1, choose a prime pp dividing this difference; then g(k)≡g(k+1)(modp)g(k)\equiv g(k+1)\pmod p, and the claim again gives the same contradiction. Hence ∣g(k+1)−g(k)∣=1|g(k+1)-g(k)|=1. More generally, if g(a)=g(b)g(a)=g(b) with a≠ba\ne b, the rigidity claim applies for every prime pp, so a≡b(modp)a\equiv b\pmod p for every prime. Choosing a prime larger than ∣a−b∣|a-b| forces a=ba=b, so gg is injective.