2023 RPN HHC Programming Contest - 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: 2023 RPN HHC Programming Contest (/thread-20599.html) |
RE: 2023 RPN HHC Programming Contest - Gerson W. Barbosa - 10-16-2023 03:37 AM (10-16-2023 02:31 AM)Allen Wrote: indeed.. the others are less practical as they require too many terms for a short program! Meanwhile, by using a(n) = n² + n - 1, for n = 6, 8 instead, I was able to save one more byte: Code:
13 steps, 25 bytes. Or, back to a(n) = n² - n - 1, for n = 7, 9 and assuming a positive number in stack register X, one more step can be saved: Code:
12 steps, 25 bytes. RE: 2023 RPN HHC Programming Contest - Craig Bladow - 10-21-2023 03:56 PM Here is my 24 byte program which tied for first place with Jason's program. CC41 was quite helpful in the program development process. Code:
RE: 2023 RPN HHC Programming Contest - Allen - 10-21-2023 07:26 PM Craig, Thank you for the interesting CC41 program and congrats on the solution at the conference! I really love the "load and run this program on start"!! On the face that seems really handy, and I was preparing to do on the computer what I've been doing by hand the last week or so, until... There are a few small behaviors that are somewhat different than a normal 41C would do: Code: > pi x: 3.1416 y:50.0000 z:0.0000 t:32.0000 l:50.0000 a: (this is correct for input of 50.0000, but 49.9985 should say "DATA ERROR" and leave x value unchanged?) or Code: > pi x: 3.1416 y:0.0000 z:41.0000 t:50.0000 l:49.0000 a: (0.00 is not a valid oct to dec conversion for anything except input of 0.000 . should say "DATA ERROR" and leave x value unchanged?) Neither of these x values would be allowed without error checking the OCT->DEC command for integer input not containing the '9' digit in the base10 number. the DEC->OCT command does not have the numerical restriction, but should check for integer input. Code: > 5.5 x: 5.5000 y:0.0000 z:0.0000 t:41.0000 l:49.0000 a: should also return error and leave x value unchanged? I confess I've only looked at it for a few minutes, so if this is something clearly addressed in the nicely written manual (which I did search for notes on OCT and DEC behaviors) , it is my own lack of reading and I apologize in advance. RE: 2023 RPN HHC Programming Contest - Craig Bladow - 10-21-2023 10:25 PM Allen, Thanks for trying CC41. I'll reply to your post in this thread regarding CC41. Cheers, Craig RE: 2023 RPN HHC Programming Contest - David Hayden - 10-23-2023 06:51 PM Here's my 3rd place entry at 25 bytes. Code: 01 LBL "HHC" Dave RE: 2023 RPN HHC Programming Contest - Gerson W. Barbosa - 10-26-2023 08:07 PM (10-23-2023 06:51 PM)David Hayden Wrote: Here's my 3rd place entry at 25 bytes. Thank you for posting your code. It’s always interesting to see the various approaches to the problem. My first attempt was also 25-byte and 17-step long, based on an easy to find approximation, which was subsequently reduced to the 24-byte 16-step one I first mentioned. I remember having used both ∑+ and ∑- in a past contest, when it was already over, I think. Trying these at home with lots of free time is quite a different thing than solving them at the conference while participating in various activities, though. Just for the record, before I throw away my notes, I will leave below my first two attempts. Also, I tried a small variation on Gene’s challenge. Instead of placing 71 and 41 on the stack, I thought of displaying just a single constant, 7141. I imagined it could be done using fewer steps, but I didn’t find anything shorter than 13 steps on the 41C (or 18 bytes and 12 steps on the HP-42S, by loosening the rules to allow a 42S-specific feature, but not ATOX). Best regards, Gerson. —— Code:
Code:
RE: 2023 RPN HHC Programming Contest - Paul Dale - 10-26-2023 08:47 PM Gerson's challenge to get 7141 can be done in 7 steps: PI LN ->H LOG ACOS x^2 INT Pauli RE: 2023 RPN HHC Programming Contest - Gerson W. Barbosa - 10-26-2023 09:11 PM (10-26-2023 08:47 PM)Paul Dale Wrote: Gerson's challenge to get 7141 can be done in 7 steps: Indeed! I would need pi/2 times more steps. Perhaps I should have suggested the more appropriate 4241 which can be done in 6 steps on the 42S, excluding LBL and END :-) (That would depend on a positive number on the stack, though) RE: 2023 RPN HHC Programming Contest - Gerson W. Barbosa - 10-26-2023 11:41 PM (10-26-2023 09:11 PM)Gerson W. Barbosa Wrote:(10-26-2023 08:47 PM)Paul Dale Wrote: Gerson's challenge to get 7141 can be done in 7 steps: HP-41C: Code:
HP-42S: Code:
For some reason on Free42 (3.0.21) it stops at step 11 with an error message (Invalid Data). P.S.: On Free42 the result at step 10 is 3680.999999999999999999999999999995 instead of 3681. →OCT requires an integer argument. That’s an example of a program that works on the HP-42S but not on Free42 because the internal results are not rounded to the number of digits of the display like on the latter. |