The desired functions have the form
f(n)={c,dn,n=1,n≥2,
where c,d are positive integers. It is straightforward to check that the problem conditions are met.
In the governing equation, taking n=2 leads to f(4m)=4f(m) for m≥2. By iterations, it follows that
f(4km)=4kf(m)1◯
for all m≥2.
Claim For positive integers m,p with m≥2, f(pm)=pf(m).
Proof of claim Induct on p: when p=1, the conclusion is trivial; assume p≥2 and the conclusion is valid for all positive integers less than p. Now, if p is composite, the conclusion is validated by the induction hypothesis. In the following, assume p is a prime. Taking n=p in the governing equation, we obtain
f(p2(p−1)m)=p2(p−1)f(m)
for all m≥p. By the induction hypothesis,
p2(p−1)f(m)=f(p2(p−1)m)=(p−1)f(p2m),
and thus
f(p2m)=p2f(m)2◯
for all m≥p.
Next, take n=p2 in the governing equation to get
f(p5(p−1)m)=p5(p−1)f(m)
for m≥p2. In a similar manner, it follows by induction that
f(p5(p−1)m)=(p−1)f(p5m).
Hence,
f(p5m)=p5f(m)3◯
for m≥p2.
Based on the above argument, we take k with 4k≥p2: for any m≥2,
4kp4f(pm)=2◯4kf(p5m)=1◯f(4kp5m)=3◯p5f(4km)=1◯p54kf(m).
Therefore, f(pm)=pf(m), and the induction is completed.
According to the claim, particularly for m≥2,
2f(m)=f(2m)=mf(2).
Taking m=3, we infer that f(2) is even. So for m≥2, f(m)=dm, where d=2f(2) is an integer. □