7
$\begingroup$

example calculator game

You and your friend are playing a game with the CASIO fx-570EX calculator.

The game proceeds as follows:

  1. Your friend types a number, then presses a left parenthesis, and then types another number(e.g., 17(65537). Each of the numbers must be represented by either a single digit (0-9) OR a digit of (1-9) followed by multiple (0-9)s.
  2. Then, without pressing any more buttons, your friend covers the screen of the calculator and hands it to you.
  3. You should press some buttons without knowing your friend's input, to calculate the sum of those two numbers. In this case, you might press <LEFT><LEFT><LEFT><LEFT><LEFT><DEL><+><=> to get the correct answer, which is 65554.

However, the above button presses will only work for limited inputs; the solution will only work for inputs where the second number is five digits long.

Therefore, you face this question: in which way should you press the buttons to make sure you always get the correct answer?

  • Moreover, what is the minimal number of necessary button presses?
  • (Yet unsolved) Can you find the solution that is capable of calculating the sum of big numbers(close to 10^9), without making any discrepancies?

Notes:

  • The CASIO fx-570EX calculator looks like this. This is the only calculator acceptable for now, because it is the only one I can test.
  • Any buttons on the calculator can be used in your solution. You can even press <=> multiple times(without checking the result), as long as you get the correct answer after the final <=>.
  • You can make use of errors ONLY IF they can be detected outside of the calculator screen. I don't think this is possible, because this calculator doesn't make sounds as far as I know.
  • As this is my first puzzle, please let me know of any ambiguity.
  • I have found my own solution, and I think I will post it after some time passes.
$\endgroup$
0

2 Answers 2

8
$\begingroup$

Disclaimer: I do not have this particular calculator, so I can't tell whether this sequence of keypresses is quite correct. But the idea behind it should be correct, and easily adaptable to any scientific calculator. The features I rely on are:

the cursor, multiplication-by-concatenation (rather than always needing an explicit ×), and variables for storage.

Here's my strategy:

[-] [1] [STO] [A]

Now, the expression is 𝑥(𝑦-1), and the result of this is stored to variable [A]. (Apparently the actual key there is the [(-)] key , but once you press [STO] it automatically shifts to alpha mode.)

[↑] [↑] [enter]
Take the expression you just evaluated, and put it back in the text box...
[⌫] [⌫] [⌫] [)] [=]
...and take out the -1, then re-evaluate it.

The current state is: $x(y-1)$ is stored in variable A, and $xy$ is the previous calculation's answer.

Now it's easy to get the data we need:
[-] [A] [STO] [x]
Subtracting the two gives $x$...

[x] [+] [A] [/] [x] [+] [1]
...and now we can calculate $x + \frac{x(y-1)}x + 1$, which evaluates to $x+y$.

$\endgroup$
3
  • 1
    $\begingroup$ As you mentioned, your solution can be easily translated into CASIO. Congratulations, and thank you for solving! :) $\endgroup$
    – EsoJihun
    Commented Aug 9, 2021 at 8:57
  • $\begingroup$ As the calculator crops off digits when the results get too big, this solution acts differently for numbers big enough. Would you mind trying out for the added challenge? :) $\endgroup$
    – EsoJihun
    Commented Aug 9, 2021 at 9:06
  • $\begingroup$ This solution results in an error if $x = 0$. $\endgroup$
    – L. F.
    Commented Aug 15, 2021 at 2:12
6
$\begingroup$

Here is an approach that handles numbers on the order of $10^9$ accurately (tested with $123\,456\,789 + 987\,654\,321 = 1\,111\,111\,110$). The hard part was

working around the fact that the first operand might be zero, in which case it is not possible to retrieve the second operand via $xy / x$.

The steps are as follows: (I did not test this with the exact same calculator, so the details might vary slightly)

=
Save the expression "$x(y$" for future use.
× 0 + 1 STO A
Evaluates "$x(y \cdot 0 + 1$", which is always equal to $x$, and stores the result in $A$.
+ =
Loads the expression "$x(y$", inserts + after the first digit of $x$, and calculates the result. The result will only be used in the future when $x = 0$, in which case "$0 + (y$" evaluates to $y$, which is equal to $x + y$. Otherwise, the result is unused.
) ÷ ALPHA A + ALPHA A =
Evaluates $x(y) \div A + A$, where $A = x$. If $x = 0$, then we will end up with the error screen; otherwise, $x + y$ will be successfully calculated.
AC Ans =
Exits the error screen if $x = 0$, and evaluates Ans. If $x = 0$, then the result of the second to last step is used; otherwise, the result of the last step is loaded.
In both cases, the result is $x + y$.

Note that

although errors are used in this solution, the sequence of key presses does not depend on whether an error was encountered. Therefore, the entire operation can be done blindfolded.

$\endgroup$
2
  • 2
    $\begingroup$ Wow, I never imagined that it would be possible to make use of errors! Your method can easily be translated to be applicable in my calculator as well. It is a very clever solution and surely works for all inputs I tested of, including 0(1 and 12346789(987654321. I think I will test more inputs tomorrow since it is currently 12 a.m. in where I live :) $\endgroup$
    – EsoJihun
    Commented Aug 15, 2021 at 15:02
  • 1
    $\begingroup$ Yes, this solution works! This method prevents multiplication because the calculator does as much calculation as possible and then truncates the numbers. Thank you for solving this! :) $\endgroup$
    – EsoJihun
    Commented Aug 20, 2021 at 5:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.