The Museum of HP Calculators

HP Forum Archive 11

[ Return to Index | Top of Index ]

More a curiosity than a challenge...
Message #1 Posted by Vieira, Luiz C. (Brazil) on 10 Mar 2003, 6:14 a.m.

Hi;

One curiosity (or chalenge): given three numbers A, B and C in the stack (X-, Y- and Z- registers) what's the shortest way to get (A+B+C), A, B and C in any order in the stack by using only the stack registers and stack manipulations?

Before   After  or     or    or...

X A A A+B+C A Y B B A A+B+C Z C C B - T - A+B+C - C

L - - C B

I know an easy way with the HP42S:

ENTER
RCL - ST Z
RCL - ST T

or in an HP41:

ENTER
R^  (ROLL-UP)
ST+ Y
R^  (ROLL-UP)
ST+ Z

but I would like to know the shortest way to do it in, say, a Voyager, or in an HP32SII, or in an HP12C. Restrictions are the calculator's resources themselves. Any clues?

This is intented to activate some stand-by, RPN-mode, stack-simulation areas of contributors' brains. And, of course, I want to know a better, shortest way to do it.

Hope you like it.

Luiz C. Vieira - Brazil

      
Oops!! Typo..
Message #2 Posted by Vieira, Luiz C. (Brazil) on 10 Mar 2003, 6:46 a.m.,
in response to message #1 by Vieira, Luiz C. (Brazil)

Hi;

the HP42S procedure is:

ENTER
RCL + ST Z
RCL + ST T

Forgive me!

Luiz C. Vieira - Brazil


[ Return to Index | Top of Index ]

Go back to the main exhibit hall