title: Map rainbow colors to RGB
body: <p>Suppose I have a class RainbowColorsMapper with the constructor <code>RainbowColorsMapper(int n)</code>, where n>=2. Now I want to have continuous mapping of rainbow colors from red to violet which I get using the method <code>mapper.getColor(int number)</code> where low values correspond to red end, and high near n to violet end. If n = 2, <code>mapper.getColor(0)</code> returns most left color of the spectrum (near red), and <code>mapper.getColor(1)</code> returns the most right color. Same with bigger n with automatic scaling.</p>
  
  <p>My question: can this be done relatively easy, and if yes what are suggestions on the algorithm? </p>