a) Let p be a prime and suppose that p is a divisor of Dn. Then p is a divisor of
((a+1)n+(a+2)n+(a+3)n)−(an+(a+1)n+(a+2)n)=(a+3)n−an
for all positive integers a. Choose now a=p, then p∣(p+3)n−pn, or (p+3)n−pn≡0modp. This is simply 3≡0modp, so p=3. We conclude that Dn only contains prime factors 3 and thus is of the form 3k with k≥0.
b) For k=0 we take n=2. It holds that 12+22+32=14 and 22+32+42=29 and these two have no prime factors in common, so D2=1. Now assume that k≥1. We will prove that Dn=3k for n=3k−1.
First, we show that 1n+2n+3n for n=3k−1 is divisible by 3k, but not by 3k+1. For k=1 it is n=1 and indeed 1+2+3=6 is divisible by 3, but not by 32. For k≥2 it holds that n>k and thus 3n is divisible by 3k+1. What we need to prove is thus equivalent to: 1+2n for n=3k−1 is divisible by 3k but not by 3k+1. We prove this by induction on k. For k=2 it is n=3 and indeed 1+8=9 is divisible by 9, but not by 27. Let m≥2 and assume we have proven this for k=m. Take n=3m−1. We know that 1+2n is divisible by 3m, but not by 3m+1. We want to show that 1+23n is divisible by 3m+1, but not by 3m+2. Write 1+2n=3mc with 3∤c. Then 2n=3mc−1, so
1+23n=1+(3mc−1)3=33mc3−3⋅32mc2+3⋅3mc
Modulo 3m+2 this is congruent to 3m+1c and since 3∤c it follows that this is divisible by 3m+1, but not by 3m+2, as we wanted to prove. This completes the induction. Now we show that for n=3k−1 it holds that (a+3)n−an is divisible by 3k for all positive integers a. We prove this again by induction on k. For k=1 it is n=1 and indeed (a+3)−a=3 is divisible by 3. Now let m≥1 and assume we have proven this for k=m. Take n=3m−1. Then we know that (a+3)n−an is divisible by 3m, so we can write (a+3)n=an+3mc for some integer c. Taking the third power on both sides gives
(a+3)3n=a3n+3a2n⋅3mc+3an⋅32mc2+33mc3,
so
(a+3)3n−a3n=a2n⋅3m+1c+an⋅32m+1c2+33mc3.
This is divisible by 3m+1, which completes the induction.
We have now proven for n=3k−1 that 3k∣1n+2n+3n and 3k∣(a+3)n−an for all positive integers a, from which it follows directly by induction on a that 3k∣an+(a+1)n+(a+2)n for all a. Thus 3k∣Dn. Since 3k+1∤1n+2n+3n it also holds that 3k+1∤Dn. Therefore, Dn=3k.