title: Algorithm for listing all multiples possible by set of numbers than is less than x
body: <p>I'm trying to work on a sub-problem of an larger algorithm which I am really struggling on!</p>
  
  <p><strong>The Problem</strong></p>
  
  <p>If I had a array of numbers (say <strong>A</strong>), how can I efficiently list all the numbers that can be made by multiplying the numbers together (which can be used as many times as you want) and is less than another number (say <strong>x</strong>). </p>
  
  <p>For example, let's say I had <strong>A = [7, 11, 13]</strong> and x was <strong>1010</strong>, the answers would be:</p>
  
  <pre><code> - 7 = 7
   - 11 = 11
   - 13 = 13
   - 7*7 = 49
   - 7*11 = 77
   - 7*13 = 91
   - 11*11 = 121
   - 11*13 = 143
   - 13*13 = 169
   - 7*7*7 = 343
   - 7*7*11 = 539
   - 7*7*13 = 637
   - 7*11*11 = 847
   - 7*11*13 = 1001
  </code></pre>
  
  <p>I tried my best not to miss any (but feel free to edit if I have)!</p>
  
  <p>I can tell this is probably some type of recursion but am really struggling on this one!</p>
  
  <p><strong>Optional</strong></p>
  
  <p>A naive solution will also be nice (that's how much I'm struggling).</p>
  
  <p>Running time is also optional.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>All numbers in <strong>A</strong> are all the prime numbers (except 1, 2, 3, 5) got from the <strong>sieve of eratosthenes</strong>.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p><strong>A</strong> is also sorted</p>
  
  <p><strong>UPDATE 3</strong>
  All numbers in A is under the limit</p>
  
  <p><strong>UPDATE 4</strong>
  The solution does NOT need to be recursion. That was just an idea I had. And Java or Pseudo code more preferable!</p>