The Puzzle
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[0] XOR ((NOT In[1]) AND (In[2] XNOR In[3]))
We want you to find the sum of the set of answers for the following circuit:
((In[0] NAND (NOT (((In[1] XNOR In[2]) NOR (In[3] OR In[4])) NOR ((In[5] AND In[6]) NAND (In[7] NOR In[8]))))) AND (NOT In[9]))
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
Submit
Please submit your answer along with the code or algorithm you used to solve the problem, if applicable here.