We prove by induction that f(n)=nf(1).
Let c1,c2,…, be the sequence of positive integers such that f(ci)=pik. Then one has
f(ci−(d+1))+f(d+1)∣f(ci)=pik
and hence f(ci−(d+1))=pij−f(d+1) for some positive integer j≤k. By pigeonhole principle, there are infinitely many i that gives us the same j and hence we can assume that j is fixed since we can just consider that sequence instead. Similarly, one has f(ci−k)=pij′−f(k) for some fixed positive integer j′. Now we have
f(1)+f(ci−(d+1))∣f(ci−d)⟹pij−f(d+1)+f(1)∣pij′−f(d).
Let j′=aj+b where 0≤b<j. Then our divisibility condition becomes
pij−f(d+1)+f(1)∣(f(d+1)−f(1))apib−f(d)
but since b<j and a<k, the RHS is less than the LHS when pi is large enough which is a contradiction unless the LHS equals zero. In which case one has
(f(d+1)−f(1))apib=f(d)
and so b=0, giving us (f(d+1)−f(1))a=f(d). On the other hand, one also has
f(1)+f(d)∣f(d+1)
giving us
(f(d+1)−f(1))a+f(1)∣f(d+1).
Letting f(d+1)−f(1)=c, one has
ca+f(1)∣c+f(1)
which is impossible unless ca=c, in which case either c=1 or a=1. If c=1, then f(d)=1 and f(1)+f(d−1)∣f(d) is impossible. Thus it must be that a=1 which gives us f(d+1)=f(d)+f(1). By induction, f(n)=nf(1) as desired.
Now clearly any function satisfying f(n)=nf(1) satisfies the second condition. For the first condition, it is clear that one must have f(1)=1. Hence the only solution is f(n)=n for all n∈Z+.
f(n)=n for all n∈Z+.