input: def tribonacci_sequence(n):
      """The Fibonacci sequence is well-known, having been thoroughly studied by mathematicians over the past few centuries.
      However, less familiar is the Tribonacci sequence.
      The Tribonacci sequence is determined by the following recurrence relation:
      tribonacci(1) = 3
      tribonacci(n) = 1 + n / 2, if n is even.
      tribonacci(n) =  tribonacci(n - 1) + tribonacci(n - 2) + tribonacci(n + 1), if n is odd.
      For instance:
      tribonacci(2) = 1 + (2 / 2) = 2
      tribonacci(4) = 3
      tribonacci(3) = tribonacci(2) + tribonacci(1) + tribonacci(4)
                     = 2 + 3 + 3 = 8 
      Given a non-negative integer n, the task is to return a list containing the first n + 1 
      numbers of the Tribonacci sequence.
      Examples:
      tribonacci(3) = [1, 3, 2, 8]
      """
output:     
      if n < 0:
          return []
  
      sequence = [3]
      for i in range(1, n + 1):
          if i % 2 == 0:
              sequence.append(1 + i / 2)
          else:
              if i == 2:
                  sequence.append(sequence[1] + sequence[0] + sequence[3])
              else:
                  sequence.append(sequence[i - 1] + sequence[i - 2] + sequence[i + 1])
      return sequence
  