Friday, October 28, 2016

calculation puzzle - Does this need to be fixed?


I found this device the other day - it seems like a calculator, but the results it's giving me don't make any sense. Here, if I try this...


$6 + 3 = 38$


See! It doesn't make any sense at all. Should be nine. And this should be seven, right?


$2 - -5 = 37$



Nope. ... Both thirty something huh. It isn't always. I'll try again.


$4 \times -3 = 17$


And once more...


$4 \times -9 = 5$


I think this thing is broken. Any ideas?


If I entered $-2 \times 5$, what would the output be? Why?


Hint 1:



I tried plugging is some more calculations. Also, the device reset or something before I started this, whatever that means. Anyways.
$24 + 3 = 6$

$-3 \times 1 = 9$
$-4 \div 2 = 2$
[No reset occurs between the main sequence and $-2 \times 5$ being entered in the puzzle itself]



Hint 2:



Since the device is a computer, I added the tag.
[You don't need to know any computer stuff to work this out - but this might help guide you in the right direction.]




Answer




You are using an unusual real-world device called



an RPN calculator.



Calculations:



The stack starts off containing 32 due to whatever you did before the puzzle, and the top-of-stack value is displayed on-screen (oddly the screen seems to show you the bottom of the stack not the top; I'm not sure about that bit). I have omitted some of the intermediate states. Stack contents are shown as [bottom ... top].
6 + [38]
3 2 - [38 1]
- [37]

5 4 * [37 20]
- [17]
3 4 * [17 12]
- [5]
9 [5 9]
The = key seems to allow you to enter two consecutive numbers without them getting concatenated into one, so "3 2" would give you ones values on the stack: [32], but "3 = 2" puts two values on: [3 2]. Or maybe "=" causes the display of the bottom-of-stack rather than the top-of-stack that I'd expect from an RPN calculator.



And for the question:



- [-4]

2 * [-8]
5 [-8 5]
so "-8" would be displayed on-screen unless the "=" key is what causes the bottom-of-stack to be displayed, in which case the screen would show "5", because this final calculation doesn't have an "=".



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 \...