title: Time complexity of recursive algorithm for denomination task
body: <p>I calculate all possible variants of input number k for 1, 2 or 5 numbers. It's easy algorithm for understanding:</p>
  
  <pre><code>//1,2,5
  func foo(k: Int, result: [Int] = []) {
      if k == 0 {
          print(result)
          return
      }
  
      var one = result
      one.append(1)
      foo(k: k-1, result: one)
  
      if k &gt;= 2 {
          var two = result
          two.append(2)
          foo(k: k-2, result: two)
      }
  
      if k &gt;= 5 {
          var five = result
          five.append(5)
          foo(k: k-5, result: five)
      }
  }
  </code></pre>
  
  <p>So, it works. My question is what is complexity (big O) of this algorithm?
  I assume it's 3^k, because of 3 recursive calls inside.
  Please prove or explain your opinion.</p>