Solution:
The answer is (E). The condition that n and n+5 have the same color is equivalent to restricting the problem to the 5 congruence classes modulo 5 (which we will keep calling 0,1,2,3,4).
Let us now study the second condition; let us write down all the possible ways to obtain a number as the product of two others:
0≡0⋅k with k∈{0,1,2,3,4}
1≡1⋅1≡2⋅3≡4⋅4
2≡1⋅2≡3⋅4
3≡1⋅3≡2⋅4
4≡1⋅4≡2⋅2≡3⋅3
Each congruence implies that if the product is white then one of the two factors is white. One can see that the color of 0 does not affect the colors of the other classes.
On the other hand, if 1 is white, then 4 is also white; if 4 is white then both 2 and 3 are white; if 2 (or 3) is white then either 3 (or 2) is white or 4 is white, but 4 white implies both 2 and 3 white.
Summing up, if 1 is white, then 2, 3 and 4 are also white. If 4 is white, but 1 is not, 2 and 3 are white. Finally if 2 is white, but neither 1 nor 4 is, then 3 is also white, and vice versa.
We therefore have four cases for the classes in {1,2,3,4} colored white: {1,2,3,4}, {2,3,4}, {2,3}, ∅.
Recalling that 0 can be colored independently, we obtain 6⋅(1+5+52+54)=3936 different colorings.