title: All possible permutations with a condition
body: <p>I'm wondering if there is an elegant way in Ruby to come up with all permutations (with repetitions) of some integers with the requirements that 1)  Integers introduced must be in ascending order from left to right 2) Zero is exempt from this rule.</p>
  
  <p>Below, I have a subset of the output for three digits and the integers  0,1,2,3,4,5,6,7,8,9.  This is only a subset of the total answer, and specifically it is the subset which starts with 5.  I've included notes on a couple of them</p>
  
  <pre><code>500  - Zero is used twice
  505  - 5 is used twice.  Note that 504 is not included because 5 was introduced on the left  and 4 &lt; 5
  506
  507
  508
  509
  550
  555
  556
  557
  558
  559
  560
  565 - Though 5 &lt; 6, 5 can be used twice because 5 was introduced to the left of 6.
  566
  567
  568
  569
  570
  575
  577
  578 
  579
  580
  585
  588
  589
  590
  595
  599
  </code></pre>
  
  <p>I need to be able to do it for arbitrarily long output lengths (not just 3, like this example), and I need to be able to do it for specific sets of integers.  However, zero will always be the integer to which the ordering rule does not apply.</p>