17
$\begingroup$

You have to calculate $\sqrt{2}$ on your scientific calculator by only pressing these buttons:

[  7  ][  8  ][  9  ][ DEL ][ A C ]
[  4  ][  5  ][  6  ][  ×  ][  ÷  ]
[  1  ][  2  ][  3  ][  +  ][  -  ]
[  0  ][  .  ][×10^x][ ANS ][  =  ]

...which are the bottom-most buttons on it. How can you achieve this by pressing buttons less than or equal to seven times?

  • What it means to calculate the square root is to make a difference smaller than $10^{-9}$. Therefore, if your calculator shows 1.414213562 after the final =, the solution is valid. Higher accuracy isn't a problem at all.
  • Important: = does NOT count as button presses.
  • Your solution cannot assume that a specific value is previously stored in ANS.
  • Just for clarification, you cannot use SHIFT and ALPHA as well.

Note: This problem is a sequel to The Blindfold CASIO fx-570EX Puzzle. However, you can use any scientific calculator for this challenge.

$\endgroup$
11
  • 2
    $\begingroup$ Will think about this problem. A suggestion for the series, by the way: Instead of specifying some very specific model of calculator to be the final judge, I might recommend deeming some free online scientific calculator to be the standard, so people don't second guess their syntax. $\endgroup$
    – Feryll
    Aug 14 at 5:49
  • 2
    $\begingroup$ Repeatedly, to clarify: Is this one of those calculators where e.g. pressing × at the start of a line prepends (1) nothing, (2) a constant copy of Ans, or (3) Ans? $\endgroup$
    – Feryll
    Aug 14 at 6:37
  • 5
    $\begingroup$ After looking at some of the answers, I don't see how this can be solved without knowing exactly what each of these buttons does. (Any correct answer seems to depend on a particular button that is not present on "any" calculator.) $\endgroup$
    – chepner
    Aug 14 at 19:08
  • 4
    $\begingroup$ For a moment, I thought this was a decent challenge, reminding me of times past when I used to develop keystroke sequences for my old Lloyd's Accumatic 305 4-function calculator to compute trigs and logarithms. But no, the "intended" solution as per the OP's comment on one of the answers relies specifically on the stored formula feature of some modern educational scientifics. Of course an iterative formula can be "programmed" this way. But now do sqrt(2) on a basic four-banger! Or better yet, a hand-cranked desktop calculator :-) $\endgroup$ Aug 15 at 1:15
  • 1
    $\begingroup$ @chepner, thank you for your two points. Firstly, the phrase "any calculator" was an error, so I edited it. However, although calculators are limited to scientific ones, your opinion that they will behave differently still holds. I think I will set a standard as an online scientific calculator(like the one from Google) from next challenges. For the second point, 1+2*3 should output 7, just as many scientific calculators do. $\endgroup$
    – EsoJihun
    Aug 15 at 14:23
19
$\begingroup$

I wonder if this is the answer you have in mind, because it feels kind of like cheating... Also depends on the calculator's syntax, so tell me if it's well-typed.

[ 0 ] [ = ] to set the Ans, then, [ + ] [ 1 ] [ x10^ ] [ 0 ] [ - ] [ 9 ] and repeat [ = ] as necessary until you reach your number. If [ 0 ] is not needed, this is only six presses (discounting the hundreds of billions of [ = ] presses); if you need an explicit [ Ans ] in the second expression, it would be eight presses; if [ x10^ ] syntax doesn't enter into its own parenthesized input box, it's entirely sunk.

Edit: A technique that works (in five presses!) even if the previous one doesn't:

[ 0 ] [ = ] to set Ans; then [ + ] [ 1 ] and [ = ] as needed; then [ / ] [ 2 ] (or [ / ] [ 1 ] [ 0 ] to be a little simpler, base-10) and [ = ] as needed.

Also, a hint to others regarding "noble" answers:

I've already tried some "obvious" methods involving (1) continued fractions, and (2) functional fixed-points, but to no avail in seven or less presses. Maybe I missed something, maybe not.

$\endgroup$
7
  • 1
    $\begingroup$ Wow, I never imagined this would be possible! Both two methods are completely valid, as they are less than seven buttons long. You can check out Deusovi♦'s answer for my intended solution. Thank you for solving this! :) $\endgroup$
    – EsoJihun
    Aug 14 at 13:07
  • $\begingroup$ I am marking this answer as accepted, as this is valid and was posted earlier. $\endgroup$
    – EsoJihun
    Aug 14 at 13:11
  • $\begingroup$ Thank you; I had fun solving/deconstructing it :p $\endgroup$
    – Feryll
    Aug 14 at 15:43
  • $\begingroup$ Do you mean "novel"? $\endgroup$ Aug 15 at 16:36
  • 1
    $\begingroup$ @AndreasRejbrand Ah. I think he/she used the word noble because he/she thought their answer was a bit cheating, it's written in the top line. $\endgroup$
    – Skye-AT
    Aug 16 at 8:27
51
$\begingroup$

One possibility, if starting with an operation automatically prepends Ans:

Start with 1 =.
Then, do the equation: [Ans] / 2 + 1 / Ans. This costs six presses, since we get the first [Ans] for free.

Now mashing = gives us an arbitrarily precise approximation to √2.

Why does this work?

This is Newton's method. We start with any positive number $x$, and consider $2/x$ along with it. These two numbers multiply to give 2.

If one of them is less than √2, then the other will have to be more than √2 to "make up the difference", and vice versa -- that is, the two numbers $x$ and $2/x$ will be on opposite sides of √2. So if we average them to get a new starting point $x'$, the new pair $(x',2/x')$ will be closer to √2 than the first one.
So, we want to do the following process:
[1] Start with any positive number $x$.
[2] Calculate $2/x$.
[3] Take the average of $x$ and $2/x$.
[4] Repeat steps [2] and [3] until satisfied.

So, what is the average of $x$ and $2/x$? Doing some algebra...

$$\frac{x+\frac2x}2 = \frac x2 + \frac1x$$
And this leads to the calculation I gave, Ans/2 + 1/Ans. Step [1] is just putting 1 into Ans, steps [2] and [3] are taken care of by the second calculation, and step [4] is accomplished by repeatedly pressing [=]. So this method does what we wanted it to!

(Side note: It turns out you only need to press it four times to get within $10^{-9}$ - Newton's method converges fast! See this Math.SE answer for another explanation, and the comments for the exact numbers you get at each point.)

$\endgroup$
9
  • 2
    $\begingroup$ This is exactly the solution I intended. All this started from an attempt to solve quadratic equations with only the "simple" buttons... but that's another story. Congratulations and thank you for solving! :) $\endgroup$
    – EsoJihun
    Aug 14 at 13:06
  • 3
    $\begingroup$ This special case of Newton’s method was already known much earlier, I know it as Heron’s method: en.wikipedia.org/wiki/… $\endgroup$
    – Carsten S
    Aug 15 at 6:32
  • 2
    $\begingroup$ Small nitpick: Newton's method doesn't converge "fast". It converges wicked fast. :P $\endgroup$ Aug 15 at 22:22
  • 1
    $\begingroup$ @XanderHenderson If one is going to nitpick, Newton's method converges quickly. "Fast" is an adjective, not an adverb. $\endgroup$ Aug 16 at 19:20
  • 2
    $\begingroup$ Google Calculator unfortunately prepends the value of Ans when starting with an operation, instead of the variable Ans itself, so this method does not work there. The challenge would have been much neater (i.e., portable) if eight presses were allowed... $\endgroup$
    – wimi
    Aug 17 at 8:41
5
$\begingroup$

2 × × 0.5 =

This works in some contexts where a double multiplication symbol (often typed as the double asterisk **) can be used to exponentiate.

$\endgroup$
1
  • 4
    $\begingroup$ This is a very clever approach, and might work for some calculators! Unfortunately, the method doesn't hold for both my one and the Google calculator. A standard calculator will be set from next challenges :) $\endgroup$
    – EsoJihun
    Aug 15 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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