title: finding f(n) in a peculiar sequence
body: <p>Let's think about a special sequence <code>f(n)</code>. In this sequence, when <code>a &lt; b</code>, then <code>f(a) &lt;= f(b)</code>.</p>
  <p>The special property of this sequence is that f(n) is the number of times n appears in the sequence.</p>
  <p>With this property in mind, we form this sequence given n:</p>
  <pre><code>n   = 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11
  f(n)= 1 , 2 , 2 , 3 , 3 , 4 , 4 , 4 , 5 ,  5 ,  5
  </code></pre>
  <p>the number 1 appears once in <code>f(n)</code>, number 2 appears twice in f(n), number 3 appears twice in f(n).</p>
  <p>I have to formulate a function so that when given <code>n</code>, I can return <code>f(n)</code>.</p>
  <p>I found an interesting pattern where in <code>f(n)</code> after the number 1, the next two numbers repeat one more than the previews number. so its like</p>
  <pre><code>22,33,444,555,6666,7777,88888,99999 ...
  </code></pre>
  <p>Maybe I can use recursion here? I am not well versed in recursion maybe someone can point me to the right direction.</p>