2023 RPN HHC Programming Contest
|
10-09-2023, 05:27 AM
Post: #41
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Hi all,
I had a little different approach for my first attempt: Code: 01 LBL "HHC" That ended up to 23 bytes all together, but also relies on that X == 0 as input. My second attempt was then instead: Code: 01 LBL "HHC" Ended up on 12 lines, 22 bytes and no requirements on the stack or input. Thanks for a funny challenge and great to see all nice solutions! RPN rules! 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-09-2023, 06:05 AM
(This post was last modified: 10-09-2023 07:41 AM by Werner.)
Post: #42
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
and here's mine: (19 bytes including END)
01 LBL "HHC" 02 PI 03 INT 04 ATAN 05 INT 06 LASTX 07 HR 08 % 09 INT 10 DEC 11 END Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
10-09-2023, 06:35 AM
Post: #43
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Mine:
Code:
|
|||
10-09-2023, 12:17 PM
(This post was last modified: 10-09-2023 12:18 PM by Bernd Grubert.)
Post: #44
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Here is mine:
Code: 01 LBL "HHC" Unfortunately with 21 bytes a little larger than the previous solutions. Anyway, thanks for the interesting challenge! |
|||
10-09-2023, 01:24 PM
Post: #45
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-09-2023 03:10 AM)Gerson W. Barbosa Wrote: 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! Thank you for the byte counts and for your nice solution! It's always interesting to see what others had come up with! One of my early approaches was based on accumulating statistical registers and the similarity of congruence: \( 71 = 6(6+5)+5 \) and \( 41 = 6*6+5 \) or something similar with \( {71,41} \equiv 11 \mod 15 \) although the plain 41C does not have an easy way to recall the STAT x,x^2, y, y^2 registers without using RCL 11 or RCL 12 number keys. I came to the conclusion there were too many steps to get that many 6, 5, and 11's on the stack! I also looked for some quick calculations that would let me poke the x,y stat registers to find a distribution that also had a MEAN or STDEV approximately 41 or 71, but this was also much harder starting from a empty stack. I also respect Thomas's clever solution based on OEIS A254308! I have several python tools that can search for those kinds of sequences based on the downloaded full list, but didn't think to search there, very nice idea! OEIS: # OEIS Sequence Data (http://oeis.org/stripped.gz) There are 198+ sequences that have 41 and 71 as consecutive entries. Some interesting ( perhaps impractical) entries: A002327 is also interesting as it allows \( a(n) = n^2-n-1 \) for \( x = {7,9} \) A125202 \( a(n) = 4n^2 - 6n + 1 \) (similar to the ulam spiral generating functions!) A064999 \(a(n) = \frac {n^3 + 3*n^2 + 2*n + 3} {3}\) - for obvious reasons this is impractical in a short program, but since it relies on \( a(4) \) and \( a(5) \) it is an interesting application of 1 to 5. A260805 \( p = q^2 - 2*r^2 \) evaluated at \( (7,2) \) \( (11,5) \) Gene, Thank you very much for the interesting challenge!! Would love to see the conference results! 17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b |
|||
10-09-2023, 01:44 PM
(This post was last modified: 10-09-2023 01:54 PM by Eddie W. Shore.)
Post: #46
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Here was mine (30 bytes, DM41X):
Code: 01 LBL^T HHC Stack: T: 0 Z: 0 Y: 71 X: 41 |
|||
10-09-2023, 04:35 PM
Post: #47
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-09-2023 01:24 PM)Allen Wrote: I also respect Thomas's clever solution based on OEIS A254308! I didn't start with a search, but I remembered that \(\frac{71}{41}\) is a pretty good approximation for \(\sqrt{3}\). And so I tried to get smaller numbers by running the Fibonacci-like sequence backwards with: Code: 01 ST-Y To avoid negative values I had to swap \(x\) and \(y\) every now and then, but in the end I came up with: y: 1 x: 1 That's a good starting point, I thought and reversed the process. And then it occurred to me that I could make the main sequence a little shorter. Only after I created the sequence did I look up if there was an easier way to do this. But I couldn't find anything that would help. We can generate increasingly better approximations for \(\sqrt{3}\) if we start with \(x = y = 1\) and iterate the following program: Code: 01 + y: 1 x: 1 R/S y: 5 x: 3 R/S y: 19 x: 11 R/S y: 71 x: 41 R/S y: 265 x: 153 R/S y: 989 x: 571 R/S y: 3,691 x: 2,131 R/S y: 13,775 x: 7,953 Their quotient converge quite fast: 1.000000000 1.666666667 1.727272727 1.731707317 1.732026144 1.732049037 1.732050680 1.732050798 1.732050807 1.732050808 1.732050808 … The reason is that these are the convergents of the periodic continued fraction of \(\sqrt{3} = [1;\overline{1,2}]\): \( \begin{align} \frac{1}{1} &= [1;] \\ \\ \frac{5}{3} &= [1;1,2] \\ \\ \frac{19}{11} &= [1;1,2,1,2] \\ \\ \frac{71}{41} &= [1;1,2,1,2,1,2] \\ \cdots \end{align} \) Thanks a lot for creating this contest and also for the many interesting contributions. |
|||
10-09-2023, 04:35 PM
(This post was last modified: 10-09-2023 04:39 PM by floppy.)
Post: #48
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
No INT and FRC (castrating effects).. a bit long.. with fenzy HHC 2023 letters inside ;-)
Code: LBL "HHC" ; x y z t HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X |
|||
10-09-2023, 04:36 PM
(This post was last modified: 10-09-2023 04:40 PM by Peet.)
Post: #49
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Many people seem to have chosen the same path for the 71, but the 41 seems to have numerous variations ... as the romans says ... all roads lead to 41.
Code:
My calculators - former: CBM PR100, HP41CV, HP11C, HP28S - current: HP48G, HP35S, Prime, DM41X, DM42, HP12C |
|||
10-09-2023, 04:37 PM
(This post was last modified: 10-09-2023 04:39 PM by born2laser.)
Post: #50
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
I took a hand at it too, longer in steps but at least according to V41-CX just 24 bytes (not as good as many here). I actually did it on 40 years old CV, but copied in the simulated CX to count bytes (lazy, I know).
Stack: T: 11 Z: 11 Y: 71 X: 41 Code:
|
|||
10-10-2023, 09:11 AM
Post: #51
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
I had a couple of attempts in using the 11c RAN# function for the challenge. This sequence gets 71 on the stack:
Code:
I never figured out how to get 41 from the first two RAN# commands. / ACOS INT gives 82. |
|||
10-10-2023, 10:20 AM
Post: #52
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Hello!
(10-10-2023 09:11 AM)Paul Dale Wrote: I had a couple of attempts in using the 11c RAN# function for the challenge. This sequence gets 71 on the stack: That's an interesting and very unusual approach! But how do you make it work? On my HP-11C, no matter what I use to seed the random number generator with, I don't get "41" and/or "71" as a result. Regards Max |
|||
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 } Code:
Dave - My mind is going - I can feel it. |
|||
10-11-2023, 07:00 PM
Post: #54
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Gene? Posts of, in person, winning RPN Contest solutions from Jason and Craig?? If I recall, correctly, there was a tie.
~ Jim J. ~ |
|||
10-11-2023, 10:46 PM
Post: #55
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-10-2023 10:20 AM)Maximilian Hohmann Wrote: That's an interesting and very unusual approach! But how do you make it work? On my HP-11C, no matter what I use to seed the random number generator with, I don't get "41" and/or "71" as a result. It won't directly, the idea was to get a non-zero value onto the stack using RAN# and then manipulate it into the required form. Because the rules specified a memory lost starting state, the random sequence is entirely predictable. All of the other solutions needed to go from a stack of zeros to something non-zero (e^x, ACOS, pi, ...). This was a different way of doing it that which didn't work out. Pauli |
|||
10-12-2023, 10:52 AM
Post: #56
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-09-2023 04:27 AM)Paul Dale Wrote: 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: If a clear stack is assumed then at least one 10-step solution is possible; Code:
20 bytes, though. I don’t like the idea of counting with a zero on the stack either. |
|||
10-12-2023, 11:13 AM
Post: #57
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
Who won?
HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X |
|||
10-13-2023, 05:51 AM
Post: #58
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest | |||
10-14-2023, 03:30 AM
Post: #59
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
(10-09-2023 01:24 PM)Allen Wrote: OEIS: 13 steps and 26 bytes. Not enough for a winning solution, but definitely not impractical.. |
|||
10-16-2023, 02:31 AM
Post: #60
|
|||
|
|||
RE: 2023 RPN HHC Programming Contest
indeed.. the others are less practical as they require too many terms for a short program!
17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)