|More a curiosity than a challenge...|
Message #1 Posted by Vieira, Luiz C. (Brazil) on 10 Mar 2003, 6:14 a.m.
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:
RCL - ST Z
RCL - ST T
or in an HP41:
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