> However, we also see that for only those combinations starting with a T (that is f(n - 1))...
Why is that f(n - 1)?
Why is that f(n - 1)?
def f(s):
assert(s[0] == 'T')
return s[1:]
whose inverse is def f_inverse(s):
return 'T' + s def f(s):
assert(s[0] == 'H')
assert(s[1] == 'T') # can't be another H!
def f_inverse(s):
return 'HT' + s
Therefore, since sequences either begin with a T or an H, for n>=2 we see f(n) = f(n-1) + f(n-2).