Operations on binary numbers, that have equal numbers of two available digits, that preserve this property?

40 Views Asked by At

I'm looking for operations on binary numbers that have the same number of the available digits, $0$ and $1$, such as $100011$, $100101$ and $10$. These could be integers as the examples given are, or restricted, for example to specific rational ranges.

That preserve this quality, so that the $1$'s count is still equal to the $0$'s count.

Can an example be given?

I'm interested in this for possible compute applications, however this question as posed seems a better fit for maths.SE.