Suppose you are given a bit string $B[1 ... n]$. Now, suppose that some bits are just padding bits conveying no information, the rest of the bits may be permuted and some meaningful (that is, non-padding) bits should be inverted from $0$ to $1$ and vice versa.
According to my intuition, the total number of interpretations is $$ I(B) = \sum_{i = 0}^n \binom{n}{i} i! 2^i. $$ The idea is that we choose all bit combinations, one by one. Then, we permute each combination. Finally, we multiply by $2^i$ in order to take the bit inversions into account.
Is this formula correct?
Example
$p$ as padding, meaningless bit. $b$ as non-padding, meaningful bit. $\bar{b}$ as meaningful, inverted bit.
- $pp$
- $pb$
- $p\bar{b}$
- $bp$
- $\bar{b}p$
- $bb^\prime$
- $b\bar{b^\prime}$
- $\bar{b}b^\prime$
- $\bar{b}\bar{b^\prime}$
- $b^\prime b$
- $b^\prime \bar{b}$
- $\bar{b^\prime}b$
- $\bar{b^\prime}\bar{b}$
Note that $I(B[1 … 2]) = 13$.