# 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.]

• Just to clarify, is the first one supposed to be 6+2 or 6+3? Your statement after the "wrong" answer says "Should be eight". So either it should be nine, 6+2, or it's a clue... – Josh May 13 '16 at 16:53
• I knew I would go wrong somewhere. Yeah, that's an A-Level Maths student not being able to work out 6 + 3. Thanks for flagging it up though. – ShadowCat May 13 '16 at 16:57
• Welcome to puzzling, and thanks for a good looking first puzzle. I hope there is enough information to solve it with all the changes in operations in your examples, we shall see... – Jonathan Allan May 13 '16 at 17:53
• Is the '-' key used for the binary subtraction the same as the one for unary negation? And in either case, do you press the unary negation key before typing in the subsequent number or after? And do the answers to these questions matter? :) – KeyboardWielder May 13 '16 at 18:18
• I think you're trying deactivation codes, but the timer keeps ticking down. I suggest running away (that's no calculator...) – elmer007 May 13 '16 at 18:29

You are using an unusual real-world device called

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 "=".

• Welcome to Puzzling, and nice answer! – Deusovi May 13 '16 at 23:31
• - 2 * 5 = ... -8! Yeah, that seems to be it. Thanks. Out of character time: Nice job - RPN is also called postfix - did you notice the fix in the title? (Also, due to the 6 + 3 = 8 thing [see main post comments], I guess my post did need to be fixed. :P) – ShadowCat May 14 '16 at 8:39
• @ShadowCat: I did notice the "fixed" in the title, but could only think of fixed-point vs. floating-point... BTW, a regular calculator uses infix. An alternative title could have been along the lines of, "Just how do I fix this?" – KeyboardWielder May 14 '16 at 10:26

Well, I feel like I'm close, so I'll post what I have and maybe someone else can fill in what I'm missing:

The first (or only) digit of each answer is the absolute value of the difference of the two numbers to the left of the equals sign. |6-3|=3 , |2-5|=3 , |4-3|=1 , |4-9|=5

...

For the first two examples, the second digit is the sum of the number of letters it takes to spell each number. Six (3) + three (5) = 8 , two (3) + five (4) = 7

...

So, using the first two points, I can make 38, 37, 1?, and 5?

...

The "7" of the answer "17" and the single-digit answer "5" I can't make fit

• (1) I believe that your first spoiler block is missing a few words from what you mean.  I’m reluctant to be more specific, as I can’t easily do that without revealing the insight that you’re hiding.  (2) The OP gave us a clue that order matters: $6+3 ~~\neq~~3+6$.  So you’re obviously missing something.  (But I don’t have any better ideas.) – Peregrine Rook May 13 '16 at 19:43
• @PeregrineRook Oh well, I thought I was on to something- I guess not :/ – elmer007 May 13 '16 at 20:44

Here are some thoughts/observations that might help someone else:

It seems as though the answer is the difference followed by the sum of the two numbers (clue 1 is off by 1 and clue 4 doesn't fit): 2 - - 5 -> 3,7 4* -3 -> 1,7.
I don't know how the operations come into play, but the answer could be 37 again or maybe -37