I need to build a deterministic turing machine to the languge:
$L = \{ a^ib^j | j=2^i \}$
I figured that I need to delete one $a$ for every ${2^i}$ $b$ until the tape contains no $a$ or $b$ or both. Then deciding whether the word is in the language is easy.
For example, this will be accepted - $aabbbb$, but this won't - $aaabbbbbb$.
I fail to understand how to change the tape as explained above. I manage to delete $b$ $2i$ times, instead of $2^i$ times.
The machine below assumes the input is a string of $a$'s follows by a string of $b$'s, and the tape otherwise has all $0$'s.
The machine will try to cut the number of $b$'s in half for every $a$. So, when the input is indeed of the form $a^ib^j$ with $j = 2^i$, then when there are no $a$'s left, there should be exactly one $b$ left. If that is indeed the case, it will Accept.
The machine will Reject if it ever gets into one of these conditions:
There are no $a$'s to start with in the first place (so now it is in state $8$), but it finds there are no $b$'s either.
There are no $a$'s left, erased a $b$ (so now it is in state $9$), but finds there are still more $b$'s left.
After the string of $a$'s (now it is in state $1$) it finds there are no $b$'s
To cut the number of $b$'s in half, the machine will erased a $b$ for every $b$ that it replaces with a $c$. If it replaced a $b$ with a $c$ but finds there is no additional $b$ to erase, then that means the number of $b$'s was odd. So, if it ever finds that after at least $a$ was erased (now it is in state 2), then something is amiss.
Especially with this last feature, I think this machine is pretty quick. For example, if it gets as input $aabbbbbbb$, it quickly determines there is an odd number of $b$'s, and will Reject.