# How many unused inputs are there in a BCD adder?

My book provides this BCD adder with the truth table:

Since this is meant to add number in BCD there are combinations that aren't going to be used. My book asks to calculate how many of such combinations are there. I did:

$$[(6*9)*2+(6*6)*2]*2 = 360$$

6*9 is the valid ones times the invalid ones. 6*6 is the invalid ones. I multiply each of these by two because you can have them one way around or the other. Lastly I multiplied by 2 because the input carry can be either 1 or 0. But my book says the solution is 312. What went wrong?

• There are $16\times 16$ possibilities without the carry. This is doubled when you add in the carry, so there are a total of $2\times 16\times 16=512$ possible input permutations. Out of this, only $2\times 10\times 10=200$ are valid inputs -- obviously. Therefore, the answer is $512-200=312$. I honestly don't want to understand your own confusion here, so I didn't try to dig in enough to follow where you went wrong in your head. But it's wrong.
– jonk
Dec 26, 2019 at 5:10
• @jonk Looking at your answer I think I know what went wrong. I multiplied by 9 instead of 10. Thanks Dec 26, 2019 at 5:14
• Okay. If that gets it, great! It's certainly the case that there is 0-9, or 10 valid permutations for each input. Glad it helped. Best wishes!
– jonk
Dec 26, 2019 at 5:15

Like you commented, you have to multiply with 10 instead of 9. There is however another point incorrect.

You need to add the invalid ones times the invalid ones once, so

$$[(6*\color{red}{10})*2+(6*6)*\color{red}{1}]*2 = 312$$

Jonk's approach is $$2*((a+b)^2-a^2)$$ Rewriting $$2*((a+b)^2-a^2) =$$ $$2*(a^2+2ab+b^2-a^2) =$$ $$2*( 2ab + b^2 )$$ which is your approach.