Clock Hands Challenge - 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: Clock Hands Challenge (/thread-12539.html) |
Clock Hands Challenge - RMollov - 03-02-2019 02:47 AM I wonder what would be the shortest 2 line display HP/DM calc program to show at what time (exact to a second) past given hour hands would be at 0 AND 180 degrees. I've solved it, but I'm sure forum's geniuses would be able to come up with better solution. RE: Clock Hands Challenge - Dieter - 03-05-2019 07:17 PM (03-02-2019 02:47 AM)RMollov Wrote: I wonder what would be the shortest 2 line display HP/DM calc program to show at what time (exact to a second) past given hour hands would be at 0 AND 180 degrees. I have read this sentence several times, but obviously my command of the English language is not sufficient to get its meaning. But then... as I write this there are more than 170 views of this thread, but still no reply (this is the first one). Maybe your idea is really a bit hard to get? For instance the part with "hour hands would be at 0 AND 180 degrees". All clocks I know have exactly one hour hand, so it can be either at 0° or 180°, but not both at the same time ("AND"). By the way: 0° and 180° relative to what? Maybe a more detailled explanation and an example will revive this thread. Dieter RE: Clock Hands Challenge - Didier Lachieze - 03-05-2019 07:30 PM (03-05-2019 07:17 PM)Dieter Wrote: I have read this sentence several times, but obviously my command of the English language is not sufficient to get its meaning. +1, English is not my first language and I don't get what's this challenge is about. And the mention of a 2 line display program is adding to my confusion. RE: Clock Hands Challenge - ijabbott - 03-05-2019 10:16 PM Perhaps RMollov means the times at which the hour and minute hands are separated by 180 degrees? That should happen 11 times per 12 hour period, mirror symmetrical about 6 o'clock. RE: Clock Hands Challenge - Thomas Klemm - 03-05-2019 10:52 PM (03-05-2019 10:16 PM)ijabbott Wrote: That should happen 11 times per 12 hour period, mirror symmetrical about 6 o'clock. Something like this? Code: 00 { 31-Byte Prgm } Example: XEQ "CLOCK" 6.0000 7.0527 8.1055 9.1622 10.2149 11.2716 12.3244 13.3811 14.4338 15.4905 16.5433 … Cheers Thomas RE: Clock Hands Challenge - rprosperi - 03-05-2019 11:29 PM (03-05-2019 07:17 PM)Dieter Wrote: I have read this sentence several times, but obviously my command of the English language is not sufficient to get its meaning. and (03-05-2019 07:30 PM)Didier Lachieze Wrote: +1, English is not my first language and I don't get what's this challenge is about. And the mention of a 2 line display program is adding to my confusion. English IS my first language, and I could not follow it either; perhaps it is not RMollov's? I was going to comment but thought I'd wait to see if it was me; I guess not. The 2-line display comment threw me off as well, how is this related? Yes, please explain this further when you can. RE: Clock Hands Challenge - Valentin Albillo - 03-06-2019 02:10 AM . Hi, Bob: (03-05-2019 11:29 PM)rprosperi Wrote: English IS my first language, and I could not follow it either; perhaps it is not RMollov's? I was going to comment but thought I'd wait to see if it was me; I guess not. The 2-line display comment threw me off as well, how is this related? English is not my first language (that would be Spanish) but I understood it like this: "I wonder what would be the shortest program for a 2-line display HP/DM calc (i.e.: HP42S / DM42) that shows at what time (accurate to the second) past a user-specified hour (i.e.: 0:00, 1:00, ... 23:00) would the clock's hands form an angle of either 0º or 180º." Best regards. V. . RE: Clock Hands Challenge - rprosperi - 03-06-2019 02:43 AM (03-06-2019 02:10 AM)Valentin Albillo Wrote: "I wonder what would be the shortest program for a 2-line display HP/DM calc (i.e.: HP42S / DM42) that shows at what time (accurate to the second) past a user-specified hour (i.e.: 0:00, 1:00, ... 23:00) would the clock's hands form an angle of either 0º or 180º." Well, this makes sense and it is a non-trivial challenge, so it's a good guess, but I still don't follow the 2-line display aspect of the challenge. An HP-42S is, but the DM42 is not (it shows up to 5), and all the other DM models are 1-line displays. And so, if the 42S was meant specifically, why not just say 42S? Possibly the intention is to have the program OUTPUT 2 lines, 1 for 0 degrees, and 1 for 180 degrees (hence the AND)? Anyhow, I imagine we'll know soon when RMollov visits again and clarifies the challenge. RE: Clock Hands Challenge - RMollov - 03-06-2019 07:50 AM (03-06-2019 02:10 AM)Valentin Albillo Wrote: English is not my first language (that would be Spanish) but I understood it like this: Thanks, Valentin, that's it! English isn't my first language too One note, on an analog clock 13, 14 etc. do not exist, so the input ("Hour") is MOD'd to 12. Thank you all, I should have posted here my solution which does what I meant. Here it is: Code:
So hands (past "the" "Hour") are either on top of each other, or one is a prolongation of the other at the times in X and Y of HP42S or DM42 (if stack arrangement fits HP42's) running the program with "Hour" in X. Thanks and sorry for the ambiguity in my first post, hope now it's clearer RE: Clock Hands Challenge - ijabbott - 03-06-2019 05:57 PM (03-06-2019 02:10 AM)Valentin Albillo Wrote: . So either 0º or 180º would occur every \(\frac{6}{11}\) hours (22 times per 12 hour period, or 44 times a day). RE: Clock Hands Challenge - Thomas Okken - 03-06-2019 06:40 PM (03-06-2019 05:57 PM)ijabbott Wrote: So either 0º or 180º would occur every \(\frac{6}{11}\) hours (22 times per 12 hour period, or 44 times a day). Not only that, but the 0° and 180° events are uniformly spaced: there is a 0° event exactly halfway between two adjacent 180° events, and vice versa. You could generalize this further by counting the moments when the hands are at right angles to each other, which always happens halfway between 0° and 180°, or 180° and 0°. RE: Clock Hands Challenge - Thomas Klemm - 03-06-2019 07:28 PM (03-06-2019 06:40 PM)Thomas Okken Wrote: Not only that, but the 0° and 180° events are uniformly spaced: there is a 0° event exactly halfway between two adjacent 180° events, and vice versa. The peculiar thing happens between 5 and 6 o'clock when the order of the 0° and the 180° event changes. Examples: 5 XEQ "CLOCK" y: 6.0000 x: 5.2716 6 XEQ "CLOCK" y: 6.0000 x: 6.3244 Until 5 the 0° event happens before the 180° event. From 6 on the 0° event happens after the 180° event. This makes the calculation of these events "past given hour" somewhat complicated. Cheers Thomas RE: Clock Hands Challenge - xerxes - 03-06-2019 10:03 PM It's not a RPN keystroke solution, but I hope it's ok: Code: INPUT H RE: Clock Hands Challenge - Joe Horn - 03-06-2019 11:55 PM (03-06-2019 10:03 PM)xerxes Wrote: It's not a RPN keystroke solution, but I hope it's ok: Excellent! The above works on the HP-71B if a lexfile is installed which adds the DMS or HMS function (e.g. the famous, fabulous JPC ROM). If an input of 12 is allowed (since analog clocks do show a 12), then H=MOD(H,12) should be inserted after the input. RE: Clock Hands Challenge - RMollov - 03-07-2019 07:21 AM (03-06-2019 07:28 PM)Thomas Klemm Wrote: The peculiar thing happens between 5 and 6 o'clock when the order of the 0° and the 180° event changes. Yes, that is the tricky bit. Thanks RE: Clock Hands Challenge - xerxes - 03-07-2019 02:19 PM A more compact version with Joe's suggestion: Code: INPUT H The very limited FX-180P makes it somewhat complicated, but it's possible: Code: P1: 29 steps Usage example: 7 P1 RUN P2 The 180° result for 6 o'clock is excluded and gives an error. RE: Clock Hands Challenge - RMollov - 03-08-2019 03:30 AM [quote='xerxes' pid='113402' dateline='1551968341'] A more compact version with Joe's suggestion: Code: INPUT H Very elegant! Based on it here is my RPN (HP42S/DM42) take: Code:
Cheers |