title: Building an upper triangular matrix recursively
body: <p>Ive been breaking my head over trying to come up with a recursive way to build the following matrix in python. It is quite a challenge without pointers. Could anyone maybe help me out?</p>
  
  <p><img src="https://i.imgur.com/MeRAjpn.png" alt=""></p>
  
  <p>The recursion is the following:</p>
  
  <pre><code>T0 = 1,
  Tn+1 = [[Tn, Tn],
          [ 0, Tn]]
  </code></pre>
  
  <p>I have tried many iterations of some recursive function, but I cannot wrap my head around it.</p>
  
  <pre><code>def T(n, arr):
      n=int(n)
      if n == 0:
          return 1
      else:
          c = 2**(n-1)
          Tn = np.zeros((c,c))
          Tn[np.triu_indices(n=c)] = self.T(n=n-1, arr=arr)
          return Tn
  arr = np.zeros((8,8))
  T(arr=arr, n=3)
  </code></pre>