Answer: r=2,3.
Suppose that r≥4. Since there are infinitely many primes, there are same coloured primes p and q. Since all divisors of n=pq are 1,p,q,pq, and hence no divisor of n=pq is coloured into some of r≥4 colours. Thus, the problem conditions are not satisfied.
Let r=3. Each positive integer n with prime factorization n=p1a1⋅p2a2⋯pmam we colour to (a1+a2+⋯+am)(mod3). The number n=1 with t=0 we colour to 0. By induction over the number of different primes in the prime factorization of n we will show that this colouring satisfies the problem conditions. Let dn(0),dn(1),dn(2) be the number of divisors of n=p1a1⋅p2a2⋯pmam coloured to 0,1,2, respectively.
If t=0 then the corresponding d(0)=1,d(1)=0,d(2)=0 and conditions are held. Suppose that problem conditions are held for all integer numbers with t=m and consider a=p1a1⋅p2a2⋯pmam⋅pm+1am+1, with da(0),da(1),da(2). Let db(0),db(1),db(2) be the number of divisors of b=p1a1⋅p2a2⋯pmam of colours 0,1,2, respectively. By induction hypothesis
∣db(i)−db(j)∣≤1 for all pairs (i,j), where i,j=0,1,2.(†)
Any divisor of a has a form d⋅pm+1u, where d is a divisor of b and 0≤u≤am+1. Then
dpm+13l+0(0)=db(0),dpm+13l+0(1)=db(1),dpm+13l+0(2)=db(2)
dpm+13l+1(0)=db(2),dpm+13l+1(1)=db(0),dpm+13l+1(2)=db(1)(‡)
dpm+13l+2(0)=db(1),dpm+13l+2(1)=db(2),dpm+13l+2(2)=db(0)
Let d(0)+d(1)+d(2)=D.
Case 1: am+1=3l. Then by (\ddagger)
da(0)=db(0)+lD,da(1)=db(1)+lD,da(2)=db(2)+lD
and hence by (\dagger) the conditions are held.
Case 2: am+1=3l+1. Then by (\ddagger)
da(0)=db(0)+lD+db(2),da(1)=db(1)+lD+db(0),da(2)=db(2)+lD+db(1)
and hence by (\dagger) the conditions are held.
Case 3: am+1=3l+2. Then by (\ddagger)
da(0)=db(0)+lD+db(2)+db(1),da(1)=db(1)+lD+db(0)+db(2),da(2)=db(2)+lD+db(1)+db(0)
and hence the conditions are held.
Let r=2. Each positive integer n with prime factorization n=p1α1⋅p2α2⋯pmαm we colour to the colour (α1+α2+⋯+αm)(mod2). As in the case r=3, it can be readily shown that this colouring also satisfies the problem conditions.
Therefore, the only possible values of r are 2 and 3.