RPL Micro-Challenge: Christmas in July
|
07-19-2017, 02:07 PM
(This post was last modified: 07-19-2017 02:12 PM by Gerson W. Barbosa.)
Post: #21
|
|||
|
|||
RE: RPL Micro-Challenge: Christmas in July
(07-19-2017 01:42 PM)Dave Britten Wrote: Oh, duh, I was doing COMB(x+2, x-1), completely forgetting about the symmetric nature of combinations. I did that as well. (x+2)!(x-1)!/6. (37.5 bytes) COMB(x+2, x-1) (27.5 bytes) COMB(x+2, 3) (20 bytes) PS: Next, this "masterpiece" :-) « DUP 2. + IDN →DIAG PCOEF SWAP GET ABS » (38.5 bytes) |
|||
07-19-2017, 03:24 PM
Post: #22
|
|||
|
|||
RE: RPL Micro-Challenge: Christmas in July
(07-19-2017 12:56 PM)Joe Horn Wrote: This is an example of program optimization being obtained not by code optimization but by math optimization. Clever, and good eye to recognize the pattern, which I did not. Though, I have become re-acquainted with the AUR as a result of this challenge. I was looking for some form of the PI (Product) function, since this is also PI, for i, 0 to 2 of (x + i) / (1 + i), though even if I found it, the formula still needed more bytes than 20. Still, educational and fun, so thanks for that Joe. For those interested, John Meyer wrote-up a very interesting PI solution, here. --Bob Prosperi |
|||
07-19-2017, 03:28 PM
Post: #23
|
|||
|
|||
RE: RPL Micro-Challenge: Christmas in July | |||
07-19-2017, 03:51 PM
Post: #24
|
|||
|
|||
RE: RPL Micro-Challenge: Christmas in July
(07-19-2017 02:07 PM)Gerson W. Barbosa Wrote: PS: Next, this "masterpiece" :-) This is what I had: Code:
Code:
Needs to be compiled in exact mode (no dot in the integer vector) and you get 38 bytes and 38.5 bytes respectively. |
|||
07-19-2017, 04:14 PM
Post: #25
|
|||
|
|||
RE: RPL Micro-Challenge: Christmas in July
82 bytes and counting :-)
« → n « '∑(j=1,n,∑(k=1,j,k))' EVAL » » |
|||
07-19-2017, 04:37 PM
(This post was last modified: 07-19-2017 04:42 PM by Gerson W. Barbosa.)
Post: #26
|
|||
|
|||
RE: RPL Micro-Challenge: Christmas in July
(07-19-2017 12:56 PM)Joe Horn Wrote: EDIT: I just noticed something cool. If you run the program above on an input of 'X' (undefined), and then EVAL the resulting mess, you get this: It works with most programs: X « 1 + DUP ACOSH SINH SQ * 6 / » EVAL LIN FACTOR --> 'X*(X+1)*(X+2)/(3*2)' |
|||
07-19-2017, 06:22 PM
(This post was last modified: 07-19-2017 06:25 PM by Gilles59.)
Post: #27
|
|||
|
|||
RE: RPL Micro-Challenge: Christmas in July | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)