Python Code Example
Here is a short Python script to implement method 2 for generating the symbolic code for the nth iteration of the terdragon curve.
n = input("n = ") #order of iteration
b = ['']
for k in range(1,3**(n-1)+1): #mod 1,2 positions
b += ['R','L','']
for k in range(1,3**(n-1)): #multiples of 3 positions
b[3*k] = b[k]
b = "".join(b[1:-1]) #convert list to string
print(b)
