input: 
  def sierpinski_triangle(n):
      """Generate and print the first n rows of the Sierpinski triangle using a bit pattern representation.
      >>> sierpinski_triangle(3)
        1  
       1 1 
      1 0 1
      >>> sierpinski_triangle(6)
           1          
          1 1         
         1 0 1        
        1 0 0 1       
       1 0 1 0 1      
      1 0 1 1 0 1     
      """
      for i in range(n):
          for j in range(n - i - 1):
              print(" ", end=" ")
          for j in range(2 ** i):
              if j % 2 == 0:
                  print("1", end=" ")
              else:
                  print("0", end=" ")
          print()
  
output:     for i in range(n):
          row = []
          for j in range(i + 1):
              if j == 0 or j == i:
                  row.append("1")
              else:
                  row.append(str(int(row[j-1]) ^ int(row[j])))
          print(" " * (n - i - 1) + " ".join(row))