On Question 2, you can assume that the input is in unary notation,
and the leftmost symbol is the dollar sign.
That is, the input is of the form ``$ 00...0''.
If there are n 0's in the input, then the tape should contain
the dollar sign followed by n^2 0's, followed by all blanks,
upon halting.
Start with pseudocode describing at a high level how the TM will
operate. For the formal description of the TM, you should use
a single tape Turing Machine. Completely describe
all states, Q, that your TM will use. Describe the transition
function, delta, with as much detail and accuracy as you can
so that one could easily write down the full transition diagram from
your TM description.