When a logic circuits has n ordered inputs, it is possible to identify each possible input pattern with a n digit integer where the ith bit of the digit represents the state of the ith input. If this bit is one, the input is set. If the bit is zero, the input is cleared.
If the circuit has one output, it is possible to define the set of all the integers representing the input patterns where the output is true.
For the following circuit,
the input patterns that set the output are [0, 3, 5, 7, 9, 11, 12, 15]. For instance 12 is an answer since setting the inputs 2 and 3 and clearing the inputs 0 and 1 sets the output. The sum of this set of answers is 62.
This circuit is pretty simple, and easy to read in a diagram format. But, for more complex circuit, we can also use a textual representation for the same circuit:
Out=In XOR ((NOT In) AND (In XNOR In))
We want you to find the sum of the set of answers for the following circuit:
((In NAND (NOT (((In XNOR In) NOR (In OR In)) NOR ((In AND In) NAND (In NOR In))))) AND (NOT In))
That’s it! Good luck!
A quick reminder that only one submission is allowed per participant. Also feel free to give us a shout out and post yourself cracking this challenge. #SmartrekCodeChallenge
Please submit your answer along with the code or algorithm you used to solve the problem, if applicable here.