If you write down 0 when dividing by 2, 1 when subtracting 1, the trajectory gives the binary expansion of n. Could someone tell me if this comment is correct, that is, if it's possible to arrive at the binary expansion of n by following the procedure of writing down one when subtracting and zero when dividing by two?
It's right in spirit but a couple of the details are wrong. Here's the right version:
When you subtract 1, the next thing you do will always be to divide by 2. You need to write down a 1 for each (subtract 1 then divide by 2) operation and a 0 for each other (divide by 2) operation. And you continue not until reaching _1_ but until reaching _0_. (You'll always reach 0 by subtracting 1; at that point you actually don't halve next because you're done; but write down a 1 anyway.) Then you'll get the binary expansion of the starting number, read from right to left.
For instance, suppose you start with 13 whose binary representation is 1101. It goes like this:
13 is odd, so subtract 1; 12 is even, so halve. Write down 1.
6 is even, so half. Write down 0.
3 is odd, so subtract 1; 2 is even, so halve. Write down 1.
1 is odd, so subtract 1. (And, if you like, halve 0 to get 0.) Write down 1.
So you've written 1, 0, 1, 1: the digits of 13's binary representation, read from right to left.
--
g