Python Code Example
Here is a short Python script to implement method 2 for generating the symbolic code for the nth iteration of the Heighway dragon curve.
n = input("n = ")
b = ['']
for k in range(1,2**(n-2)+1): #odd positions
b += ['R','','L','']
for k in range(1,2**(n-1)): #even positions
b[2*k] = b[k]
b = "".join(b[1:-1])
print(b)
