Solution : For every M in 2 to N, let prime factorization of M be M=product(piei). Then M will be colored by color number sum(ei). Eg, 12=22x31, then color 12 by color number (2+1)=3. Additionally, number 1 will require a totally different color, since it divides all other numbers.
Code:
Code:
No comments:
Post a Comment