HHC 2017 RPN Programming contest information and results thread - 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: HHC 2017 RPN Programming contest information and results thread (/thread-9084.html) |
RE: HHC 2017 RPN Programming contest information and results thread - Gene - 09-19-2017 09:11 PM It was 10 for RPN and 5 for RPL. I did not highlight all entries, just the top 2 or 3 in each. RE: HHC 2017 RPN Programming contest information and results thread - jjohnson873 - 09-20-2017 03:10 PM After 40 years of not programming on my HP-41CX, I was just "HAPPY" to come up with a program that worked correctly even though my solution was 82b, (didn't count the registers). I spent most of my time trying to figure out how to format the display to show characters and the loop count, as well as merging "un" with "happy". Was in the process of optimizing to eliminate registers when time ran out. Congratulations to Roger Hill for winning the RPN programming contest. And congrats to Werner who came up with a nice 66b solution. Now that I can see all of the tips and tricks, I'll be armed with all of the shortcuts and clever stack manipulation for HHC 2018's contest! Also, thank you to Gene for coming up with a challenging contest. (BTW....the program ran MUCH faster on my phone emulator for the HP41CX) RE: HHC 2017 RPN Programming contest information and results thread - jjohnson873 - 09-20-2017 03:16 PM I'm curious. Is there a table that shows the number of bytes that each instruction takes on the HP-41CX? I'd love to have that for future reference. RE: HHC 2017 RPN Programming contest information and results thread - Thomas Okken - 09-20-2017 03:32 PM (09-20-2017 03:16 PM)jjohnson873 Wrote: I'm curious. Is there a table that shows the number of bytes that each instruction takes on the HP-41CX? I'd love to have that for future reference. Here's one: http://www.hpmuseum.org/prog/bytetab.htm That page also has a link to a more detailed table. The table only covers the basic HP-41C instruction set; all the additional functions in the CX are two bytes. RE: HHC 2017 RPN Programming contest information and results thread - Didier Lachieze - 09-20-2017 03:35 PM The byte count is included in the Function Tables at the end of the HP 41CX Owner's Manual Vol. 2 RE: HHC 2017 RPN Programming contest information and results thread - Gene - 09-23-2017 04:31 PM Winning RPN Program entry HHC 2017 by Roger Hill. 70 bytes LBL "HAPPY" "UN" ABS CLST LASTX X<>Y LBL 01 RDN ISG Z LBL 02 10 / ENTER FRC X^2 STO+ Z RDN INT X != 0? (X NOT EQUAL TO ZERO) GTO 02 X<>Y 2 10^X * 4 X=Y? GTO 03 SIGN X !=Y? (X NOT EQUAL TO Y) GTO 01 CLA LBL 03 |- "HAPPY " (APPEND HAPPY AND A SINGLE SPACE) FIX 0 CF 29 ARCL T FIX 4 SF 29 AVIEW END RE: HHC 2017 RPN Programming contest information and results thread - Craig Bladow - 09-24-2017 11:37 PM Congratulations Roger! And his solution doesn't need any of the extra instructions one gets with an HP-41cx. Thanks Gene for a great contest this year! RE: HHC 2017 RPN Programming contest information and results thread - Jeff O. - 10-01-2017 09:50 PM Best I could do on my own before checking the solutions here was 70 bytes, no registers. I kept searching the manual for a command to convert a byte code to a number (to avoid 48, -), but sadly, no such command exists. Using SIGN in lieu of RDN, 1 drops mine to 69 bytes. (I'll never remember that function!) Without a major re-write that would likely just turn it into one of the ones provided by others, I don't see any opportunities for improvement. The improved (using SIGN) program is provided below for review. Thanks Gene, another fun and interesting challenge. Maybe I am mistaken, but it seems like there are lots more "Unhappy" than "Happy" numbers. Is this true? Did anyone figure out what the highest number of cycles for a 10 digit or smaller number leading to a "Happy" result is? Code: 01 LBL HAPPY RE: HHC 2017 RPN Programming contest information and results thread - Don Shepherd - 10-01-2017 11:14 PM (10-01-2017 09:50 PM)Jeff O. Wrote: Did anyone figure out what the highest number of cycles for a 10 digit or smaller number leading to a "Happy" result is? I think Eric Smith figured it out (for an unhappy number): 16 cycles for number 15,999. I don't know if anyone figured out the largest number of cycles leading to a happy number. RE: HHC 2017 RPN Programming contest information and results thread - Jeff O. - 10-02-2017 07:30 PM Answering my own questions: (10-01-2017 09:50 PM)Jeff O. Wrote: ... Maybe I am mistaken, but it seems like there are lots more "Unhappy" than "Happy" numbers. Is this true?Well, for the numbers 1 through 1000 (calculated using excel, not my program above), 143 are "Happy" and 857 are "Unhappy". So this implies more "Unhappy" results. But my guess is that there are infinite "Happy" and infinite "Unhappy" numbers, and I'm not sure this is a case where one infinity is bigger than another. (10-01-2017 09:50 PM)Jeff O. Wrote: Did anyone figure out what the highest number of cycles for a 10 digit or smaller number leading to a "Happy" result is?I will go out on a limb and postulate that the maximum number of cycles for a 10 or fewer digit number leading to a "Happy" result is 7. I will further postulate that the largest "Happy" number of 10 digits or less requiring 7 cycles is 9,999,999,998, and the smallest such number is 78,999. |