HP Forums

Full Version: And another 12c mini-challenge (phi)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

After the rather difficult pi challenge, I thought I'd propose another (hopefully) easier challenge. This time we're after the golden ratio, phi, which is approximately 1.6180339887...

Now, the obvious six command / seven keystroke sequence on the 12c is:

    5 g-sqrt 1 + 2 /

This results in 1.618033989 on the display (assume FIX 9 is already set). I think it would be difficult to better this but I would be very interested in a shorter sequence if such is found.

However, let us presume for some unknown reason that we want the resulting digits correct and unrounded. That is, we want 1.618033988 on the display. Now clearly this can be done in four additional steps/keystrokes with

    5 sqrt 1 + 2 / EEX 9 CHS -

However, it can be done with fewer. Specifically, it can be done in at most the same number of operations and keystrokes as the correctly rounded version I gave initially. That is, six operations maximum and seven keystrokes maximum.

Is anybody up to this challenge?

- Pauli

How about

[3] [6] [cos] [2] [x]

You get phi. I assume the angle mode is degrees.


Nice solution, which for some reason I didn't remember. Still it would save a key stroke on a 15c.

However, we're on a 12c which doesn't have COS and I asked for phi unrounded which is (phi - 10^-9).

- Pauli

edit: got the keystroke count wrong

edit: and then realised I hadn't

Edited: 15 Jan 2009, 11:18 p.m. after one or more responses were posted

You are right. There is no cos in the 12c. However, one who needs to work with phi will most likely use an 11c, 15c, 41c, 42s, and so on. So why not use the more appropriate tool?


This is a challenge and for scientific things the 12c is often not the best suited which makes it more interesting...

- Pauli

So how is it best suited for trig functions (for example)? It takes pretty much a long set of keystrokes to emulate predefined trig functions in the scientific calculators. I learned that it is better to work smarter than harder.

It looks like replacing EEX 9 CHS - with 1 - 1/x seems to do the trick as well. Interesting...


Yes, one of the many self referential formulas involving phi rounds the other way.

Unfortunately, 9 commands / 10 keystrokes.

- Pauli

How about the ratio of two consecutive Fibonacci numbers?

196418 enter 121393 / = 1.6180339887... (displayed as 1.618033989)


Chris Dean


That requires "beaucoup" keystrokes!!!


I forgot to mention that MY Hp-12C has a COS key!!!

Minor detail! Sorry!

Edited: 16 Jan 2009, 9:54 a.m.

Ah but so simple

I think Paul is counting keystrokes. The one that is even simpler is to simply type they value of phi.



Time for a hint. Skip this post if you want to try the challenge unaided.

The formula I used for phi (sqrt(5) + 1)/2 is still used, however you'll have to juggle the percentages to obtain the answer.

- Pauli

Obviously this is not a solution, just a different way to get phi on the 12C:

01 1
02 sqrt
03 PSE
04 1
05 +
06 GTO 02

After 19 or so iterations it will display the unrounded value of phi. However the next ones will show the properly rounded answer.

There is another 9-step solution around but it will take too long before the answer briefly appears :-)


Here is an approximation for phi that has a 5-decimal accuracy:

[5] [LN] [9] [EEX] [CHS] [3] [+]

Seven steps.


Edited: 16 Jan 2009, 9:13 p.m.

Even with the hint, no success :-(

I was seeking this solution:

    5 SQRT 5 delta% 2 %T 

- Pauli

Edited: 18 Jan 2009, 3:58 p.m.