title: Turing machine algorithm to count 0's and write how many there were in binary
body: <p>I happen to need an algorithm for a turing machine that reads a string of 0's and then writes on the tape how many there were in binary.</p>
  
  <p>I realize that in practice the machine won't actually count the 0's but I am pretty stumped as for how to do it. </p>
  
  <p>I supose first of all I'd need to mark the place where the binary number starts with an X or something, then just write a 1 for the first 0 and for each of the following 0s if least significant bit is a 0 it becomes a 1 but what if it's a 1? Maybe turn it into 0 and keep going left turing all 1s into 0s until I find a 0 or blank to turn into 1? Then again, in that case it's the same thing regardless of the LSB because I'd be doing the same only the 0 would be the first position...</p>
  
  <p>Hmm...rubber duckie...</p>