Find the largest 2^n that would fit into the number and then subtract this from the original number. From here, look at all possible 2^n-x where n-x >= 0, putting a 0 if it would not fit in what is left of the number or a 1 if it would, then subtracting this from the number.