title: why do i recieve index out of range error?
body: <p>I was trying to do the Fibonacci sequence but instead of doing the third number with the 2 past numbers y want to do the 4th number with the last 3 numbers
  my first code was this:</p>
  
  <pre><code>def tribonacci(signature, n):
      a, b, c = signature
      tribo = [signature[0],signature[1],signature[2]]
  
      for i in range(n):
          s = a+b+c
          a = b
          b = c
          c = s
          tribo.append(c)
      return tribo
  
  print(tribonacci([1, 1, 1], 10))
  </code></pre>
  
  <p>I receive [1, 1, 1, 3, 5, 9, 17, 31, 57, 105, 193, 355, 653] which mean that the sequence starts with the number 3, not with the first 1. but I don't want to append the "signature" values to the array, but instead, start adding each value to the array</p>
  
  <p>so I tried this code instead:</p>
  
  <pre><code>def tribonacci(signature, n):
      tribo = []
  
      for i in range(0, n):
          a = signature[i]
          b = signature[2*i]
          c = signature[3*i]
          s = a+b+b
          a = b
          b = c
          c = s
          tribo.append(c)
      return tribo
  
  
  print(tribonacci([1, 1, 1], 10))
  </code></pre>
  
  <p>I was expecting to get this [1, 1, 1, 3, 5, 9, 17, 31, 57, 105], but the error index out of range appears</p>