April Fools Circuit

Logic Level 5

Write your answer in decimal.


The answer is 24.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Ivan Koswara
Apr 1, 2017

So, this is my take for April Fools in 2017.

What is the problem? Well, we see a logic circuit here. The outputs provide the circuit's own inputs, so it's likely that there are contradictions if the outputs are wrong. So let's try to figure out what the outputs should be.

Call the outputs A , B , C , D , E A, B, C, D, E in that order. Remember that , + , \cdot, +, \oplus are AND, OR, XOR respectively, and A \overline{A} is the negation of A A . For sake of convenience, we'll use 0 , 1 0, 1 for false and true respectively.

The equations, if you know logic gates , are as follows:

  • A = B + C A = B + C
  • B = B C B = \overline{B \cdot C}
  • C = A E C = \overline{A \oplus E}
  • D = D E D = D \cdot E
  • E = A + D E = \overline{A + D}

How do we solve it? The self-referential equations are particularly interesting. In fact, the second equation only has one solution. If B = 0 B = 0 , then B C = 0 B \cdot C = 0 , but then B C = 1 \overline{B \cdot C} = 1 , contradiction. So B = 1 B = 1 . And now that B = 1 B = 1 , we have B C = 1 \overline{B \cdot C} = 1 , so B C = 0 B \cdot C = 0 . Since B = 1 B = 1 , we need C = 0 C = 0 .

Since we know B , C B, C , we can now deduce A = B + C = 1 A = B + C = 1 . We can then deduce E E from the third equation: 0 = 1 E 0 = \overline{1 \oplus E} , so 1 = 1 E 1 = 1 \oplus E , so E = 0 E = 0 . Finally, this allows us to deduce D D : since E = 0 E = 0 , we have D E = 0 D \cdot E = 0 , so D = 0 D = 0 .

Thus, in fact, we have a single solution! It's ( A , B , C , D , E ) = ( 1 , 1 , 0 , 0 , 0 ) (A, B, C, D, E) = (1, 1, 0, 0, 0) . So it is "an answer", even though we're still not sure what we're looking for. But it's worth a try; we have binary outputs, and it says to write the answer in decimal. So we can try reading these values as a binary number 1100 0 2 11000_2 , and interpret it to decimal, giving 24 \boxed{24} , which is indeed the answer to this problem. Hope you enjoyed it!

This problem is inspired from a more ridiculous, more unfair problem in CodeForces April Fools Contest 2017.


So, yes, this is an April Fools joke. This problem is written in the spirit of puzzlehunt puzzles ; unlike standard problems with clearly defined objective, this problem doesn't tell you what you need to do. (What is "the answer"?) On the other hand, such problems can be satisfying to solve, when you fiddle around with the data you're given and everything suddenly just clicks together. We puzzlehunters call it the a-ha! moment, because that's what you'll probably say when you get the breakthrough. How the problem doesn't need any additional information (because the circuit, the biggest thing that attracts your attention here, does have a unique solution), why there's "in decimal" (because you get a number that is not in decimal, so it serves as a check that you're trying to extract a number and also that number is not originally in decimal)...

Speaking of which, the reason I asked for the decimal number was two-fold: one, it gives you the clue that you'll be getting some number which is not in decimal, and two, this helps making sure that leading zeroes won't be a problem. (Had the answer been something like 00011, you'll see the accepted answer as "11" instead of "00011", which is unclear for people that fail to solve the problem. If it's converted to decimal, you won't care that "3" is missing a leading zero.)

I'd like to know who keeps editing the problem and for what reason. I outlined my reasons above of why I want to keep the exact phrasing.

Ivan Koswara - 4 years, 2 months ago

Log in to reply

We were wanting to use your problem for Problems of the Week.

Given your strong feelings about the phrasing, I have reverted the changes to your problem. I will feature the S ( n 4 ) S( n^4) problem instead.

Calvin Lin Staff - 4 years, 2 months ago

Log in to reply

Yeah, it's intended to be a quirky problem and I didn't expect it to be featured. Popular, maybe, but definitely not what I thought would go to Problems of the Week. Of course, I can make another version (with a different circuit) that does actually say what you're supposed to do, and you can put that one in, if you want.

Ivan Koswara - 4 years, 2 months ago

Log in to reply

@Ivan Koswara If you can make another version, that would be great! I can use it for the following week :)

I like the "self-referential" logical deductions that have to be made with this problem, and I do think it will appeal to the advanced group.

Sorry for the confusion.

Calvin Lin Staff - 4 years, 2 months ago

Log in to reply

@Calvin Lin Was a circuit problem like this featured at any time? If not, it would be interesting to see some. Thx.

Wesley Zumino - 3 years, 10 months ago

Log in to reply

@Wesley Zumino I don't think this or the other version was featured.

Ivan Koswara - 3 years, 10 months ago

Log in to reply

@Ivan Koswara Yea, it wasn't featured during that week/time period. It did make it into the consideration process, but we ended up going with other problems.

Personally, I find logic circuits and (separately) self-referential questions interesting :)

Calvin Lin Staff - 3 years, 10 months ago

Log in to reply

@Calvin Lin @Calvin Lin Perhaps the GF(2) approach might provide some insight for constructing interesting systems of equations to solve. I can give it some thought, perhaps drawing some inspiration from this and @Ivan Koswara 's other circuit problem and that circuit at the codeforces link. It would be a fun exercise. Unfortunately right now I am coming into a busy period...need another burner on my increasingly expanding stove...

Wesley Zumino - 3 years, 10 months ago

Log in to reply

@Wesley Zumino LOL I hear you! I just need each day to be 48 hours long.

I would be excited to see what you come up with.

Calvin Lin Staff - 3 years, 10 months ago

BTW, @Ivan Koswara , cute problem. Thank you for sharing it.

Wesley Zumino - 3 years, 10 months ago
Wesley Zumino
Aug 2, 2017

I took an (abstract) algebraic approach with the finite (Galois) field G F ( 2 ) GF(2) (just { 0 , 1 , + , } \{0,1,+,\cdot\} with mod 2 arithmetic). I haven’t seen this here yet, so I thought I’d share it. First, express the logical gate operators as algebraic expressions in operators, constants, and variables x , y x, y in G F ( 2 ) GF(2) . NOT x = 1 + x , x AND y = x y , x XOR y = x + y , x OR y = x + y + x y . \begin{aligned} &\text{NOT } x = 1 + x \;, \\ &x \text{ AND } y = xy \;, \\ &x \text{ XOR } y = x + y \;, \\ &x \text{ OR } y = x + y + xy \;. \\ \end{aligned} In the figure, label inputs { b n } n = 0 , , 4 G F ( 2 ) \{b_n\}_{n=0, …,4} \in GF(2) left to right as b 4 , b 3 , b 2 , b 1 , b 0 {b_4, b_3, b_2, b_1, b_0} . As per the circuit diagram, equate the logical gate outputs to the input variables to produce the following system of equations: ( 0 ) b 0 = 1 + b 1 + b 4 + b 1 b 4 , ( 1 ) b 1 = b 1 b 0 , ( 2 ) b 2 = 1 + b 0 + b 4 , ( 3 ) b 3 = 1 + b 2 b 3 , ( 4 ) b 4 = b 2 + b 3 + b 2 b 3 . \begin{aligned}(0) \; &b_0 = 1 + b_1 + b_4 + b_1 b_4 \;, \\ (1) \; &b_1 = b_1 b_0 \;, \\ (2) \; &b_2 = 1 + b_0 + b_4 \;, \\ (3) \; &b_3 = 1 + b_2 b_3 \;, \\ (4) \; &b_4 = b_2 + b_3 + b_2 b_3 \;.\\ \end{aligned} Solve by using G F ( 2 ) GF(2) ’s multiplicative idempotency ( x 2 = x x^2 = x ) and additive nilpotency ( x + x = 0 x + x = 0 ) for simplification (along with its other props).

Sub (0) into (1): b 1 = b 1 b 0 = b 1 ( 1 + b 1 + b 4 + b 1 b 4 ) = b 1 + b 1 2 + b 1 b 4 + b 1 2 b 4 = ( b 1 + b 1 ) + ( b 1 b 4 + b 1 b 4 ) = 0 + 0 = 0 b 1 = 0. b_1 = b_1 b_0 = b_1 (1 + b_1 + b_4 + b_1 b_4) = b_1 + b_1^2 + b_1 b_4 + b_1^2 b_4 = (b_1 + b_1) + (b_1 b_4 + b_1 b_4) = 0 + 0 = 0 \therefore b_1 = 0.

Sub b 1 b_1 into (0): ( 5 ) b 0 = 1 + b 4 . \begin{aligned} (5) \; &b_0 = 1 + b_4 \;. \\ \end{aligned}

Sub (5) into (2): b 2 = 1 + b 0 + b 4 = 1 + ( 1 + b 4 ) + b 4 = ( 1 + 1 ) + ( b 4 + b 4 ) = 0 + 0 = 0 b 2 = 0. b_2 = 1 + b_0 + b_4 = 1 + (1 + b_4) + b_4 = (1 + 1) + (b_4 + b_4) = 0 + 0 = 0 \therefore b_2 = 0.

Sub b 2 b_2 into (3): b 3 = 1 + b 2 b 3 = 1 b 3 = 1. b_3 = 1 + b_2 b_3 = 1 \therefore b_3 = 1.

Sub b 2 b_2 and b 3 b_3 into (4): b 4 = b 2 + b 3 + b 2 b 3 = 0 + 1 + 0 = 1 b 4 = 1. b_4 = b_2 + b_3 + b_2 b_3 = 0 + 1 + 0 = 1 \therefore b_4 = 1.

Sub b 4 b_4 into (5): b 0 = 1 + b 4 = 1 + 1 = 0 b 0 = 0. b_0 = 1 + b_4 = 1 + 1 = 0 \therefore b_0 = 0.

Therefore, b 4 b 3 b 2 b 1 b 0 = 1100 0 2 = 2 4 10 . b_4 b_3 b_2 b_1 b_0 = 11000_2 = \boxed{24_{10}} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...