title: Consider a sequence u where u is defined as follows:
body: <p>Consider a sequence u where u is defined as follows:</p>
  
  <p>The number <code>u(0) = 1</code> is the first one in <code>u</code>.
  For each <code>x</code> in <code>u</code>, then <code>y = 2 * x + 1</code> and <code>z = 3 * x + 1</code> must be in u too.</p>
  
  <p>There are no other numbers in u.
  Ex: <code>u = [1, 3, 4, 7, 9, 10, 13, 15, 19, 21, 22, 27, ...]</code></p>
  
  <p>1 gives 3 and 4, then 3 gives 7 and 10, 4 gives 9 and 13, then 7 gives 15 and 22 and so on...</p>
  
  <p>Task:</p>
  
  <p>Given parameter <code>n</code> the function <code>dbl_linear</code> (or <code>dblLinear</code>...) returns the element <code>u(n)</code> of the ordered (with &lt;=) sequence <code>u</code>.</p>
  
  <p>Example:</p>
  
  <p><code>dbl_linear(10)</code> should return <code>22</code></p>
  
  <p>I have tried: </p>
  
  <pre><code>function dblLinear(n) {
    if(n === 0) {
      return 1;
    } else if(n % 2 === 0) {
      return dblLinear(n-1) * 3 + 1;
    } else {
      return dblLinear(n-1) * 2 + 1;
    }
  }
  </code></pre>
  
  <p>this is the origin link in codeWars:
  can't thought the test. help --> <a href="http://www.codewars.com/kata/5672682212c8ecf83e000050/train/javascript" rel="nofollow">link</a></p>