title: Generate sequences number with repetition
body: <p>I have the following code:</p>
  
  <pre><code>var result = AllSequences(1, 10, 3);
  
  public static IEnumerable&lt;List&lt;int&gt;&gt; AllSequences(int start, int end, int size)
  {
      if (size == 0)
          return Enumerable.Repeat&lt;List&lt;int&gt;&gt;(new List&lt;int&gt;(), 1);
  
      return from i in Enumerable.Range(start, end - size - start + 2)
             from seq in AllSequences(i, end, size - 1)
             select new List&lt;int&gt; { i }.Concat(seq).ToList();
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>1,1,1
  1,1,2
  1,1,3
  1,1,4
  ....
  2,2,2
  2,2,3
  2,2,4
  </code></pre>
  
  <p>But before coming to this sequence, wish you were like this:</p>
  
  <pre><code>2,1,1
  2,1,2
  2,1,3
  2,1,4
  .....
  </code></pre>
  
  <p>I'm having trouble generating sequence is, I'm using LINQ to gain performance in this loop</p>