Post Reply 
[VA] Short & Sweet Math Challenge #22: April 1st, 2018 Spring Special
04-07-2018, 01:05 AM
Post: #34
RE: [VA] Short & Sweet Math Challenge #22: April 1st, 2018 Spring Special
.
Hi all,

Thanks a lot for the extra feedback, much appreciated (actually your feedback it's the fuel that energizes me to post challenges and other materials !). As I did three days ago I'll address here the various things you recently either commented or asked. Let's begin:

pier4r Wrote:Let the numbers talk is a really nice idea!

Thanks ! As far as I know, it's a novel concept, I've never seen it before.

Mike (Stgt) Wrote:Thank you for this flock of easter eggs! In addition I learned that the HP11C does hyperbolic functions. Alas my question if ->H and the inverse ->H.MS was valid functions twosome stays unanswered.

The HP-11C does indeed hyperbolics (very useful to solve one-real-root cubic equations, by the way). And yes, your twosome ->H and ->H.MS are indeed perfectly valid solutions for Dessert 3 (or equivalently HR and HMS functions in the HP-71B). I didn't mention them specifically in my solutions but I did say "Some people offered valid F(X) and G(X)", which included them of course. Congratulations for finding them, good lateral thinking.

John Keith Wrote:Thank you Valentin for an interesting and fun challenge!
Though it seems like cheating, this HP49/50 program seems to meet all the rules for the main course, and it's hard to beat for size at 15.5 bytes:

<< ISPRIME? >>

Thanks for your appreciation and kind comments. As for the << ISPRIME? >> program I concur that it's quite short but, as they say, "the proof of the pudding is in the eating" so: What results does it give when applied to the six test numbers I gave ?

Gene Wrote:Interesting challenge, Valentin!
Couple of questions on the Main Course.

1) First, how about a deeper explanation? Inquiring minds want to know.
[...]
I would just like to understand better what is going on. Thanks as always...

Thanks for your continued appreciation, Gene, but my explaining it all would ruin the magic and in fact if I told you I'd have to kill you. :-D

rprosperi Wrote:Thanks for the Easter treat with your SSMC#22 Valentin, as always very educational and this time even more fun than usual.

Thak you very much, I'm happy to know that you find them educational and fun, that's my goal. I learned a lot while having lots of fun while reading Martin Gardner's Mathematical Recreations series of books and since then I've always thought that having fun inmensely enhances learning.

Quote:The conditions for Desert #2 pointed me quickly to the many unique Functions in the 71, but as you saw, that took a team effort to wrestle down.

Hehe, as I said, I like the concept of solving challenges as a team, well done.

Quote:A question for you true 71B masters: I thought all function calls (similar to '41 XROM) were 2 bytes long: 1) the LEX ID and 2) the particular Fn in that LEX (each ranging up to 255, so needing a full byte).

Yet, the answer to D#2, "RAD(OVF*UNF*OVF)" is clearly 4 functions but only 6 bytes. Hmph?!

Well, RAD(OVF*UNF*OVF) if one single-parameter function (RAD), three parameterless functions (i.e.: "constants"), OVF, UNF, OVF, and two arithmetic operators (*). Each of them is 1-byte so 1+3+2 = 6 bytes.

As for all function calls being 2-byte, that's not the case. There are 1-byte functions and there are 4-byte functions, etc. For instance:

      1 DISP is 5 bytes
      1 DISP 1 is 6 bytes (the 1 is 1-byte)
      1 DISP LOG(1) is 7 bytes (LOG is 1-byte)
      1 DISP LN(1) is 7 bytes (LN, an alternate spelling of LOG, is also 1-byte)
      1 DISP LOG10(1) is 7 bytes (LOG10 is also 1-byte)
      1 DISP LGT(1) is 10 bytes (LGT, an alternate spelling of LOG10, is 4 bytes)
      1 DISP LOGP1(1) is 10 bytes (LOGP1 is also 4 bytes)
      1 DISP LOG2(1) is 10 bytes (LOG2 is in the Math ROM and it's also 4 bytes)

so you see, in the above examples there are mainframe 1-byte functions, mainframe 4-byte functions, and external 4-byte functions. The mainframe 4-byte functions are the ones less used (LOG10 and LGT are the identical function but the former is 1-byte while the latter is 4-byte).

Something similar happens with the exponential functions, EXP is 1-byte while EXPM1 is 4-bytes. As for functions in the Math ROM we also have that DET is 4-byte and DET(A) is 5-byte (one extra byte for the A). FOUR is also 4-byte (self-describing, it seems), TRN is 4-byte as well, ditto for SYS, and so on (these last three also need a 1 MAT A=, which is 8-byte in itself, plus the bytes needed by their argument(s)

I could go on but you get the idea and it's quite easy to either experiment using CAT or a little routine using PEEK$ to display the length and tokenization of an arbitrary program line.

Again, thanks to all and best regards.
V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenge #22: April 1st, 2018 Spring Special - Valentin Albillo - 04-07-2018 01:05 AM



User(s) browsing this thread: 3 Guest(s)