title: Given a 1D ndarray and an integer, what's the most efficient way to generate this ndarray?
body: <p>Given <code>array</code> and <code>n</code> generate <code>x</code></p>
  
  <p>Input  </p>
  
  <p><code>array = [1 8 38 17]</code><br>
  <code>n = 2</code></p>
  
  <p><code>x = [1 2 3 8 9 10 38 39 40 17 18 19]</code></p>