Post Reply 
2023 RPN HHC Programming Contest
10-10-2023, 03:37 PM (This post was last modified: 10-11-2023 07:38 PM by Jeff O..)
Post: #53
RE: 2023 RPN HHC Programming Contest
Slight improvement, now only 18 steps, but still (annoyingly) 28 bytes, so hard to call it much of an improvement. Figured out that while "STO+ ST X" does not copy X to Last X, "RCL+ ST X", which accomplishes the same thing, does copy X to Last X, allowing the "X<>Y" to be eliminated. But I guess "RCL+ ST X" takes more bytes than "STO+ ST X", offsetting the savings from removing "X<>Y". Still feels a little better.
Code:
00 { 28-Byte Prgm }
01▸LBL "HHC"
02 SIGN
03 RCL+ ST X
04 LASTX
05 E↑X
06 FP
07 RCL ST Y
08 10↑X
09 ×
10 IP
11 RCL ST Y
12 SQRT
13 FP
14 RCL ST Z
15 10↑X
16 ×
17 IP
18 END
Quick and dirty, 19 steps, 28 bytes (on Free42/42S, assume the same on a 41). Just extract the "71" from e, and the "41" from square root of 2:
Code:

00 { 28-Byte Prgm }
01▸LBL "HHC"
02 SIGN
03 E↑X
04 LASTX
05 STO+ ST X
06 X<>Y
07 FP
08 RCL ST Y
09 10↑X
10 ×
11 IP
12 RCL ST Y
13 SQRT
14 FP
15 RCL ST Z
16 10↑X
17 ×
18 IP
19 END

Dave - My mind is going - I can feel it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
2023 RPN HHC Programming Contest - Gene - 10-07-2023, 01:00 PM
RE: 2023 RPN HHC Programming Contest - Jeff O. - 10-10-2023 03:37 PM



User(s) browsing this thread: 5 Guest(s)