15

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.

Rand al'Thor
  • 116,845
  • 28
  • 322
  • 627

1 Answers1

19

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

boboquack
  • 21,982
  • 1
  • 66
  • 138
  • Well, that was easier than I'd imagined. – Rand al'Thor Apr 09 '17 at 23:01
  • 1
    I hate when my calculator breaks on decimals. – Rubio Apr 09 '17 at 23:14
  • 1
    If anyone has more convoluted calculators, I'll post them as extra bonuses! – boboquack Apr 09 '17 at 23:16
  • @boboquack For my calculator operator precedence does apply and it breaks on any decimal. Unfortunately the 7-segment LED display for the second-most digit to the right is damaged (it only shows the two left-most vertical segments and the middle horizontal segment) so, for example, I can't distinguish 10 from 20. Can you help? – Penguino Apr 09 '17 at 23:56
  • 2
    @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 – boboquack Apr 10 '17 at 00:02
  • @boboquack Excellent. That saves me having to ask about my other calculator where the 10's digit is even more damaged. – Penguino Apr 10 '17 at 00:23
  • 1
    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. – Marius Apr 10 '17 at 06:18
  • @Marius Thanks! Didn't spot that! (I'd just got online when I'd posted, still a bit bleary-headed) – boboquack Apr 10 '17 at 06:21
  • My calculator's LCD display is badly damaged. The rightmost 4 digits don't display at all. For all remaining digits, the top segment is stuck on, so 1 and 7 look identical as do 4 and 9. – Rubio Apr 10 '17 at 14:40
  • @Rubio All done! – boboquack Apr 10 '17 at 22:24
  • 3
    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... – user253751 Apr 11 '17 at 02:07
  • My calculator was made by a first-year CS student in a hurry to get the project turned in, and does operator precedence backwards. (i.e. 8*4-4 == 8*(4-4) == 0). (I have no idea if this will make things harder or not) –  Apr 11 '17 at 05:21
  • @QPaysTaxes Does your calculator support decimals? – boboquack Apr 11 '17 at 05:30
  • @boboquack If you use them, you're straying into nasal demon territory. (in other words, no.) –  Apr 11 '17 at 05:32
  • @QPaysTaxes Done! Bonus - no negative numbers! – boboquack Apr 11 '17 at 05:43
  • Nice! What strategy are you using to figure these out? Or is it mostly trial/error/intuition? –  Apr 11 '17 at 06:21
  • @QPaysTaxes Yeah, just that (unfortunately). – boboquack Apr 11 '17 at 06:22
  • The calculator displays the digits in an unknown language (1 might be # and 2 might be &, etc), precedence applies, calculator breaks on anything over 100. – 3-1-4-One-Five Jan 11 '24 at 20:59