I understand the concept that the number of 1's in N is the same as N/2 if it's even, and N/2 + 1 if the number is odd, but I don't understand how to do it recursively.
Also, say I input 10101 into my machine, and I do N/2, it does 505 instead of the binary division. Do I have to convert back and forth each time?