I was going through binary codes and found out that if the weighted binary code is self complimentary then it's weights addition will be equal to 9. Is the converse true? If not then what are the sufficient conditions for making a weighted binary code self complimentary. My research was in vain. Please help and clear my doubt.

For example: 3321 is self complimentary code. 3+3+2+1 = 9


You haven't defined your terms, so let me quickly define them:

  1. A weighted binary code $abcd$ is the mapping $C\colon \{0,1\}^4 \to \mathbb{N}$ given by $$C(xyzw) = ax + by + cz + dw.$$
  2. A code $C$ is legal (my term) if $0,\ldots,9$ are all in the range of $C$.
  3. A code $C$ is self-complementing if whenever $C(xyzw) \in \{0,\ldots,9\}$, we have $$ C(\bar{x}\bar{y}\bar{z}\bar{w}) = 9-C(xyzw), $$ where $\bar{x}$ is the negation of $x$.

Since $\bar{x} = 1-x$, we have $$ C(\bar{x}\bar{y}\bar{z}\bar{w}) = a(1-x)+b(1-y)+c(1-z)+d(1-w) = a+b+c+d - C(xyzw). $$ Therefore a legal code is self-complementing iff $a+b+c+d=9$.

  • $\begingroup$ You made it so easy to understand. Thanks. $\endgroup$ – Dataset Colab Jun 3 '19 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.