2023 RPN HHC Programming Contest
|
10-08-2023, 03:22 PM
(This post was last modified: 10-08-2023 03:26 PM by ThomasF.)
Post: #21
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-08-2023 02:58 PM)Ajaja Wrote: No, you could enter "P" if you want to. As Gene wrote: "... and to challenge getting a couple of specific numbers without using digit keys to help out.", you are not allowed to enter a digit as in a number or as an argument, i.e "FIX 4". But the keys still work, so you could enter SHIFT + EEX --> RTN, or alpha "P", or SHIFT + 4 --> BEEP as in an previous example. Cheers, Thomas [35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X] |
|||
10-08-2023, 03:22 PM
Post: #22
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Yes, pressing a key as a press of a digit is allowable as long as it does not reference a data memory OR enter a direct numeric value into a program line.
Exceptions such as 1/x, etc are fine. |
|||
10-08-2023, 03:50 PM
Post: #23
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-08-2023 02:07 PM)Gene Wrote: Remember, we all want to learn and have fun :-) It has indeed been both. I used to do a LOT of RPN programming until I sold my CX to buy a 28c when it came out. I've been an RPL guy since, but I found this particular contest challenge rather intriguing, enough for me to dust off my CV and give it a try. Gene, thanks so much for posting it. I look forward to seeing everyone's solutions tomorrow. |
|||
10-08-2023, 04:53 PM
Post: #24
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
12 steps, 20 bytes.
|
|||
10-08-2023, 07:13 PM
(This post was last modified: 10-08-2023 07:15 PM by Wes Loewer.)
Post: #25
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest | |||
10-08-2023, 07:19 PM
Post: #26
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
On the HP-41CX, do a shift CAT 1 and R/S when the HHC label is shown. While that is in the display, press SST once and it should show END on the left side and the byte count on the right.
Best to do a Shift GTO . . to put an END at the bottom of the program and remove any NULLs from editing first. |
|||
10-08-2023, 07:20 PM
Post: #27
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-08-2023 04:53 PM)Gerson W. Barbosa Wrote: 12 steps, 20 bytes. Same here, first full working version 12 steps (14 including label and END), 20 bytes I have an evening activity which my body will be attending, but my mind will be in the PRG menu. 17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b |
|||
10-08-2023, 07:53 PM
Post: #28
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-08-2023 07:13 PM)Wes Loewer Wrote:(10-08-2023 04:53 PM)Gerson W. Barbosa Wrote: 12 steps, 20 bytes. I have a 41C and a 41CV, on which CAT 1 does not give the size information. I would attach the infrared module and do CAT 1 in TRACE mode, but it’s easier to use the i41CX+ emulator. By the way, I get 17 bytes on the HP-42S as well. It preserves the original X register content. No fancy instructions, it should work also on the HP-11C and HP-15C. Plain numerical listings though :-) |
|||
10-08-2023, 08:05 PM
Post: #29
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-08-2023 04:53 PM)Gerson W. Barbosa Wrote: 12 steps, 20 bytes. Wow, that is impressive! 10 bytes for LBL and END, gives 10 bytes for 10 lines, so only 10 one byte instructions! Cheers, Thomas [35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X] |
|||
10-08-2023, 08:24 PM
Post: #30
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-08-2023 07:19 PM)Gene Wrote: On the HP-41CX, do a shift CAT 1 and R/S when the HHC label is shown. While that is in the display, press SST once and it should show END on the left side and the byte count on the right. Thanks. I tried it out on the V41 emulator and the 12 steps (including LBL and END) show 20 bytes. |
|||
10-08-2023, 08:31 PM
Post: #31
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
19 bytes, 11 lines
W. 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
10-08-2023, 08:41 PM
Post: #32
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-08-2023 08:05 PM)ThomasF Wrote:(10-08-2023 04:53 PM)Gerson W. Barbosa Wrote: 12 steps, 20 bytes. Thanks, Thomas. Yes, only one-byte instructions available on most scientific HP calculators. Anyway only a couple a bytes shorter than your current solution. As I wasn’t getting any improvement, I decided to change the approach, but only slightly. I’m looking forward to your and others’ solutions. Hopefully someone comes up with a really outstanding one, mine is rather straightforward. Best regards, Gerson. |
|||
10-08-2023, 09:21 PM
(This post was last modified: 10-08-2023 09:24 PM by Peet.)
Post: #33
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
I am very curious to see some solutions, I tried and my attempt has 12 lines, 20 byte (HP41, with lbl and end).
Y: 71 X: 41 L: 41,8584 My calculators - former: CBM PR100, HP41CV, HP11C, HP28S - current: HP48G, HP35S, Prime, DM41X, DM42, HP12C |
|||
10-09-2023, 12:10 AM
Post: #34
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Preliminary 18-byte program (12 steps with label and end) Note: Byte count is in Free42 and may differ slightly in the plain 41C.
Code:
17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b |
|||
10-09-2023, 12:11 AM
Post: #35
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest | |||
10-09-2023, 12:51 AM
Post: #36
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Code: 01▸LBL "HHC" It calculates A254308: 1, 1, 2, 3, 5, 8, 11, 19, 30, 41, 71 |
|||
10-09-2023, 01:11 AM
Post: #37
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Code:
19 bytes Code:
20 bytes |
|||
10-09-2023, 03:10 AM
Post: #38
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-09-2023 12:10 AM)Allen Wrote: Preliminary 18-byte program (12 steps with label and end) Note: Byte count is in Free42 and may differ slightly in the plain 41C. Yes, on the HP-41 the number of bytes is 21. So 10 instructions and 11 bytes not considering LBL and END. All one-byte instructions except for the necessary RCL ST X. Anyway, it’s difficult to do it in 12 steps using this approach (an approximation for 41 or 71, the other obtained through the 30 units difference). Congratulations for managing to save two steps in your previous code! Gerson. |
|||
10-09-2023, 03:14 AM
(This post was last modified: 10-09-2023 03:43 AM by Wes Loewer.)
Post: #39
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Good job to those of you who got it down to 11 lines / 19 bytes.
Our similarly sized programs are more different that I anticipated. Here's my best at 12 lines / 20 bytes. Did anyone else think of converting between radians and degrees and between octal and decimal? The numbers just happen to work out pretty well. Code: 01 LBL "HHC" or using the 42 command names Code: 01▸LBL "HHC" |
|||
10-09-2023, 04:27 AM
Post: #40
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
My best:
Code: 01 LBL "HHC" I think this is equal to the previous best. I found one other approach for the first half 71, but I don't consider it as pure since it relies on a zero on the stack: Code:
I did find two equal length alternative solutions for the second half 41: Code:
Since I was using my 11c for this, I did locate a neat solution for 41, but not suitable for the 41, because it requires gamma: Code:
On the 11c there is a single step shorter solution available but, sadly, also not available on the 41 due to the use of an hyperbolic function. The first step is quite malleable, there being multiple alternatives to get 1 on the stack: x!, 10^x or EXP are equally good. Code:
I didn't properly investigate deriving 41 from 71 or viceversa but the best I could manage wasn't shorter. For example (with 71 on the stack and the prior value in last x): Code:
Pauli |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)