Sunday, April 29, 2018

pattern - The Security to the Party [Part 4]


A party is being held at a local mansion. The host is very rich and his success is because of one thing — his famous recipe for Spaghetti!


The only guests that may attend are people who correctly reply to the guard at the door.


Here's where you come in. You and a friend are trying to steal this recipe. You sneak by and listen to the passwords.


The first guest arrives. The security says "5", and the guest replies "2".


The second guest arrives. The security says "6", the guest replies "2".


The third guest arrives. The security says "3", the guest replies "2".



Your friend thinks he's got it all figured out so he walks up to the door and the security says "2". He replied "2", and is tarred and feathered and sent away in shame.


Another guest arrives, security says "0" and he says "0" to get in.


You walk up and get a "4" from security. What is your response?


Thanks for the ideas, credits to:


Part 1 was created by warspyking and is found here: The Security to the Party


Part 2 in Mew's version The Security to the Party [Part 2]


Part 3 in Kelvin Barsana's version The Security to the Party [Part 3]



Answer



Answer:




Respond $1$.



Explanation:



Put x into binary. The number of 1s in the result is the answer. Here is a key for the given numbers: $$\begin{align}5&=101 &\rightarrow 2 \\ 6&=110 &\rightarrow 2 \\ 3&=11 &\rightarrow 2 \\ 2&=10 &\rightarrow 1 \\ 0&=0 &\rightarrow 0 \\ 4&=100 &\rightarrow 1\end{align}$$



No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...