title: How to divide number into integer pieces that are each a multiple of n?
body: <p>Had a hard time coming up with a concise title for this.  I'm sure there are terms for what I want to accomplish and there is no doubt a common algorithm to accomplish what I'm after - I just don't know about them yet.</p>
  
  <p>I need to break up a number into n pieces that are each a multiple of 50.  The number is itself a multiple of 50.  Here is an example:
  Divide 5,000 by 3 and end up with three numbers that are each multiples of 50:</p>
  
  <ul>
  <li>1,650 </li>
  <li>1,700</li>
  <li>1,650</li>
  </ul>
  
  <p>I also would like to have the numbers distributed so that they flip back and forth, here is an example with more numbers to illustrate this:
  Divide 5,000 by 7 and end up with 7 numbers that are each multiples of 50:</p>
  
  <ul>
  <li>700</li>
  <li>750</li>
  <li>700</li>
  <li>750</li>
  <li>700</li>
  <li>700</li>
  <li>700</li>
  </ul>
  
  <p>Note that in the above example I'm not worried that the extra 50 is not centered in the series, that is I don't need to have something like this:</p>
  
  <ul>
  <li>700</li>
  <li>700</li>
  <li>750  &lt;--- note the '50s' are centered</li>
  <li>700</li>
  <li>750  &lt;--- note the '50s' are centered</li>
  <li>700</li>
  <li>700</li>
  </ul>
  
  <p>Hopefully I've asked this clearly enough that you understand what I want to accomplish.</p>
  
  <p><strong>Update: Here is the function I'll be using.</strong></p>
  
  <pre><code>var number = 5000;
  var n = 7;
  var multiple = 50;
  
  var values = getIntDividedIntoMultiple(number, n, multiple)
  
  function getIntDividedIntoMultiple(dividend, divisor, multiple)
  {
      var values = [];
      while (dividend&gt; 0 &amp;&amp; divisor &gt; 0)
      {
          var a = Math.round(dividend/ divisor / multiple) * multiple;
          dividend -= a;
          divisor--;
          values.push(a);
      }
  
      return values;
  }
  </code></pre>