HP Forums
Challenge: Generate a 64 in the display (RPN) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Challenge: Generate a 64 in the display (RPN) (/thread-15529.html)

Pages: 1 2 3 4


RE: Challenge: Generate a 64 in the display (RPN) - EdS2 - 09-04-2020 09:56 AM

Some brilliant and amusing solutions, but for me Didier(*) wins: the first two calculators I reached for were the HP-21 and the HP-35. No pi, no int, no factorial, no temperature conversion, no grad, no strings, no 12x, ...

(*) Or maybe Guenter, or Craig, ...

(Of course, of course, of course, the exact meaning of 'classic' would have some bearing, so that's just my observation.)


RE: Challenge: Generate a 64 in the display (RPN) - pinkman - 09-04-2020 10:38 AM

I agree.
My version:

01 CLX
02 E↑X
03 ENTER
04 +
05 X↑2
06 ENTER
07 +
08 X↑2

Mandatory functions: e^x and x^2


RE: Challenge: Generate a 64 in the display (RPN) - Gerson W. Barbosa - 09-04-2020 02:56 PM

I beg to disagree. Quoting from the OP, my underlining:

Quote:Your challenge is to take a classic RPN machine in an unknown stack circumstance and generate a 64 in the X register.
...

Who can come up with the shortest set of steps ?

Notice Gene says “a classic RPN machine”, not most RPN machines. No comment needed for his last statement. I don’t care a straw for political correctness, but I would say the award goes to Valentín Albillo, who was the first to point out to a two-step solution on the HP-42S. Sometimes it is important to find a solution quickly, even if it is not optimal, so a special award should go to Bruce. Sometimes a generic solution is desirable, then a special award should go to Didier.
Anyway, we all win when we participate in these challenges. Keep them coming!


RE: Challenge: Generate a 64 in the display (RPN) - Valentin Albillo - 09-04-2020 03:47 PM

.
Good afternoon, Gerson:

(09-04-2020 02:56 PM)Gerson W. Barbosa Wrote:  I don’t care a straw for political correctness, but I would say the award goes to Valentín Albillo, who was the first to point out to a two-step solution on the HP-42S.

Thank you very much, Gerson, toma lo que quieras.

Anyway, my solution was quite obvious for alpha-capable models and it's quite general in nature: just change the character from "@" to any other and you'll get a solution for integers other than 64, e.g. using "q" instead of "@" should get you 113 ~ 355/Pi.

Quote:Sometimes a generic solution is desirable, then a special award should go to Didier.

I agree but Didier Lachieze's "generic solution", while remarkable in its intent and fully deserving of your special award, actually is not that generic.
For instance, it doesn't work for the über-classic Voyager Series HP-16C.

Best regards and have a nice weekend. And take care !
V.


RE: Challenge: Generate a 64 in the display (RPN) - Didier Lachieze - 09-04-2020 04:25 PM

(09-04-2020 03:47 PM)Valentin Albillo Wrote:  I agree but Didier Lachieze's "generic solution", while remarkable in its intent and fully deserving of your special award, actually is not that generic.
For instance, it doesn't work for the über-classic Voyager Series HP-16C.

You're right, I overlooked the 16C, shame on me !

So here is a way in 4 steps for the 16C to display 64 in the X register without using "any of the digit keys 0 - 9, the EEX key or the decimal point" as required by the challenge rules:

Code:
HEX
A
ENTER
*



RE: Challenge: Generate a 64 in the display (RPN) - EdS2 - 09-04-2020 06:32 PM

Ah, yes indeed, 'a classic' isn't quite the same as 'any classic'. Fair enough.

And the reminder of the 16C is nice: it does make for quite the additional constraint, for a universal solution.


RE: Challenge: Generate a 64 in the display (RPN) - pinkman - 09-04-2020 06:36 PM

I beg to disagree also. ((c)Gerson W. B.)
Considering the 16C, I would say that keys A to F are to be considered as forbidden, being the natural extension of 0..9.

“ The law and the spirit of the law” say the jurists Smile


RE: Challenge: Generate a 64 in the display (RPN) - Gene - 09-04-2020 06:43 PM

The A violates the Spirit yes, but not the letter of my requirements. :-)

I have another challenge I will post next week. I'll be more specific about the models it is for that I was this time.

Appreciate all the thought that went into this.


RE: Challenge: Generate a 64 in the display (RPN) - pinkman - 09-04-2020 06:46 PM

I was joking of course.

My attempt on 16C, only available in default 16 bits word length...

BSP
NOT
SR
SR
SR
SR
SR
SR
SR
SR
SR
SR
STO f I
ISZ f I
DEC


RE: Challenge: Generate a 64 in the display (RPN) - Joe Horn - 09-04-2020 07:02 PM

(09-04-2020 06:46 PM)pinkman Wrote:  My attempt on 16C, only available in default 16 bits word length...

Ooh, that gave me an idea for a bizarre solution on the 16C in its factory-fresh condition:

ISZ
RCL I
ON+D (Press ON and hold it down, press D, then release both)
ON+D (again)
Square root
DEC

Big Grin


RE: Challenge: Generate a 64 in the display (RPN) - Didier Lachieze - 09-04-2020 07:39 PM

(09-04-2020 06:43 PM)Gene Wrote:  The A violates the Spirit yes, but not the letter of my requirements. :-)

Yes, I was cheating a bit Wink

Here a 8-step solution compliant with the spirit of the rules :

Code:
DEC 
CLEAR REG
ISZ
RCL I
SL 
SL
ENTER
RLn



RE: Challenge: Generate a 64 in the display (RPN) - Guenter Schink - 09-04-2020 07:59 PM

(09-04-2020 09:56 AM)EdS2 Wrote:  Some brilliant and amusing solutions, but for me Didier(*) wins: the first two calculators I reached for were the HP-21 and the HP-35. No pi, no int, no factorial, no temperature conversion, no grad, no strings, no 12x, ...

(*) Or maybe Guenter, or Craig, ...

(Of course, of course, of course, the exact meaning of 'classic' would have some bearing, so that's just my observation.)

Ok: should work on any scientific RPN. NO cheating Smile
PHP Code:
1 CLX
2 e
^x
3 Enter
+
5 x^2
6 Enter
7 x
^2


Günter


RE: Challenge: Generate a 64 in the display (RPN) - Hlib - 09-04-2020 08:53 PM

Russian RPN "mk-61" calculator:
1) | pi | x^2 | sign | LSTx | - | INT | x^2 |
(7 steps/13 keystrokes)
* suitable for all classic RPN machines.
2) | pi | x^2 | STO_1 | RCL(i)_1 | RCL_1 | x^2 |
(6 steps/13 keystrokes)
** RCL(i)_1 in "mk" works as INT(R1-1)➝R1 .
3) | CLRx | AND | x^2 |
EDIT: The terms of the challenge stated:
Quote:You may not use any of the digit keys 0 - 9
The [CLRx] command is almost equivalent to using the [0] key.
Therefore, it is better not to use it either. Now my conscience will be at ease:
3) | ENTER↑ | XOR | x^2 |
EDIT_END
(3 steps/5 keystrokes)
*** for "mk" only.


RE: Challenge: Generate a 64 in the display (RPN) - Valentin Albillo - 09-04-2020 11:02 PM

.
Hi again, Gene:

(09-04-2020 06:43 PM)Gene Wrote:  The A violates the Spirit yes, but not the letter of my requirements. :-)

Exactly.

Quote:I have another challenge I will post next week. I'll be more specific about the models it is for that I was this time.

Your "specification" better include the HP-71B aka "The Ugly Duckling" or you and I will have an issue.

Best regards and have a nice weekend.
V.


RE: Challenge: Generate a 64 in the display (RPN) - Gerson W. Barbosa - 09-05-2020 03:05 AM

(09-03-2020 09:10 AM)Thomas Okken Wrote:  How about the smallest number of keystrokes?

I thought that was what Gene meant, actually, and the minimum number of program steps does seem to be a bit too easy. On the 42S anyway. Smile

6 keystrokes:

◼ PGM.FCN ▲ GETKEY ◼ ×


RE: Challenge: Generate a 64 in the display (RPN) - Paul Dale - 09-05-2020 03:39 AM

The 70 is feeling left out:

Turn it off then on:
Code:
K
K
/
ENTER
+
ENTER
ENTER
K
x<>y
/
y^x

Pauli


RE: Challenge: Generate a 64 in the display (RPN) - ijabbott - 09-05-2020 06:17 AM

This is perhaps more in the spirit of the challenge for the HP-16C:

01 DEC
02 CLX
03 WSIZE
04 CLX
05 NOT
06 #B

(Edited because I mislabelled the lines.)