# Rybo switched the calculator keys!

I'm Dave.

In revenge for my calculator key-switching prank, Rybo has performed a similar prank on me!

My calculator has the usual number keys, and keys for the usual four arithmetic operations:

0123456789 ; +-x÷

All of the digits are where they should be, but two of the arithmetic-operation keys have been swapped. I don't know which two. Rybo says I'm only allowed to perform one operation - compute one sum using some of the ten digits and the four operation keys, as well as brackets () if necessary, any number of times - in such a way that the result of the calculation will tell me which two have been swapped.

Is this possible? If so, how can I do it?

Out-of-character disclaimer: I don't know the answer to this question.

• Do the operations follow precedence? Commented Apr 9, 2017 at 22:56
• @boboquack They're interpreted in the way a standard calculator would interpret them. Actually I'll make a slight edit to say brackets are also allowed to be used. Commented Apr 9, 2017 at 22:58
• Congrats on the HNQ! Commented Apr 10, 2017 at 2:10
• @boboquack I'm famous ;) Commented Apr 10, 2017 at 6:14
• @rybo And I announce your fame! Commented Apr 10, 2017 at 22:28

Try (same as if operator precedence doesn't apply):

(1+2)-3

Then:

Switching +,-: (1-2)+3=2
Switching +,x: (1x2)-3=-1
Switching +,÷: (1÷2)-3=-2.5
Switching -,x: (1+2)x3=9
Switching -,÷: (1+2)÷3=1
Switching x,÷: (1+2)-3=0

Note: If anyone has more convoluted calculators, I'll post them as extra bonuses!

Bonus: brackets not allowed, operator precedence applies:

1+2-3

Then (assuming a 9-digit calculator):

Switching +,-: 1-2+3=2
Switching +,x: 1x2-3=-1
Switching +,÷: 1÷2-3=-2.5
Switching -,x: 1+2x3=7
Switching -,÷: 1+2÷3=1.66666667
Switching x,÷: 1+2-3=0

Second bonus: brackets not allowed, operator precedence applies, calculator breaks on recurring decimals:

1+2-4

Then:

Switching +,-: 1-2+4=3
Switching +,x: 1x2-4=-2
Switching +,÷: 1÷2-4=-3.5
Switching -,x: 1+2x4=9
Switching -,÷: 1+2÷4=1.5
Switching x,÷: 1+2-4=-1

Third bonus: operator precedence doesn't apply, calculator breaks on any decimal:

8+4-4

Then:

Switching +,-: 8-4+4=8
Switching +,x: 8x4-4=28
Switching +,÷: 8÷4-4=-2
Switching -,x: 8+4x4=48
Switching -,÷: 8+4÷4=3
Switching x,÷: 8+4-2=10

Fourth bonus: operator precedence does apply, calculator breaks on any decimal:

8+4-4

Then:

Switching +,-: 8-4+4=8
Switching +,x: 8x4-4=28
Switching +,÷: 8÷4-4=-2
Switching -,x: 8+4x4=24
Switching -,÷: 8+4÷4=9
Switching x,÷: 8+4-2=10

Fifth bonus (@Penguino): operator precedence does apply, calculator breaks on any decimal, tens digit unreadable:

9+9-3

Then:

Switching +,-: 9-9+3= 3= ?3
Switching +,x: 9x9-3= 78= ?8
Switching +,÷: 9÷9-3=- 2=-?2
Switching -,x: 9+9x3= 36= ?6
Switching -,÷: 9+9÷3= 12= ?2
Switching x,÷: 9+9-3= 15= ?5

Sixth bonus (@Rubio): Operator precedence doesn't apply, decimals work, last 4 digits in display and also the top bar of any digit don't work (i.e. 1=7 and 4=9), 8 digit display + sign:

10000+729-1728

Then:

Switching +,-: 10000-729+1728= 10999= X ????
Switching +,x: 10000x729-1728= 7288272= X28 ????
Switching +,÷: 10000÷729-1728=-1714.2826=-X XXY.????
Switching -,x: 10000+729x1728= 18539712= X 853 ????
Switching -,÷: 10000+729÷1728= 6.2089120= 6.208 ????
Switching x,÷: 10000+729-1728= 9001= ????

Seventh bonus (@QPaysTaxes): operator precedence applies backwards, calculator breaks on any decimal:

8+4-2

Then:

Switching +,-: 8-4+2=2
Switching +,x: 8x4-2=16
Switching +,÷: 8÷4-2=8
Switching -,x: 8+4x2=24
Switching -,÷: 8+4÷2=6
Switching x,÷: 8+4-2=10

• I hate when my calculator breaks on decimals.
– Rubio
Commented Apr 9, 2017 at 23:14
• If anyone has more convoluted calculators, I'll post them as extra bonuses! Commented Apr 9, 2017 at 23:16
• @Penguino Done! I've assumed (like on my own calculator) that the negative sign displays on the leftmost 7-segment LED, and ignored the LED second from the right completely Commented Apr 10, 2017 at 0:02
• On small comment. In third and forth bonus parts you got 8x4-4=20. That's not right. This does not break the approach. It's just confusing. :) Also, the same bonuses 3 & 4 state 8+4-2 but the examples shown use 8+4-4. Commented Apr 10, 2017 at 6:18
• My calculator's battery is flat so it can't display any digits at all. But I know the buttons that were swapped are looser than the other two. But I only get to mash my palm against the keypad once... Commented Apr 11, 2017 at 2:07