Notation for sum/product over 1-bits in binary representation

472 Views Asked by At

Is there a notation, which indicates that an operation (sum/product/etc) should be taken over the 1-bits in a number $x$'s binary representation, i.e. those powers of $2$ that when summed up equal $x$?

Actually the question is not specific to base $2$, a notation for any base would great, but it was easier formulating it this way.

Edit to explain it in more detail:

Let's consider the number $x = 5$, it's binary representation is $101$. Now if I would want to take a sum involving these powers of two I could write $$\sum_{\substack{i\\i^{th} \text{ bit in binary representation of x is 1}} }2^i = x$$

The question is essentially if there's a less cumbersome way of defining such a sum. And if yes, if there is there a way to generalize it to higher bases.

2

There are 2 best solutions below

0
On BEST ANSWER

I don’t think there’s any standard notation for this. One possibility that’s clunky but not wordy is this: $$\displaystyle\sum_{\substack{i\in{\mathbb Z^+\cup \{0\}}\\\left(\lfloor{x\over 2^i}\rfloor\!\!\!\!\mod\!\!2\right)=1} }{\text {(summand)}}.$$ You can change the $2$ and $1$ for the particular base and digit you want. If I were to put something like this in a paper, I would explain it in sentences before the first use, and possibly make up a notation like $\text{digit}_{base\ n}(x,i)$ so it’s easier for the reader to remember the idea.

1
On

Actually , normal operations like addition , multiplication etc.are not base specific(However there are operations which are meaningful for certain base like Exclusive OR).You will get the same result if you take care of the base your numbers are in.The numbers in specific base have their notation,like a binary no. is denoted by $a_2$,but there is no need for notation for operation.$11_2 + 100_2=111$ is equivalent to $3_{10}+4_{10}=7_{10}$