# What are the sufficient conditions for weighted binary code to be self compliementary?

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

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$$.