Challenge: Generate 24 in the X register / display
|
09-07-2020, 01:26 PM
Post: #21
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
Sometimes, it feels like there are more lawyers in here than calculator fans...
--Bob Prosperi |
|||
09-07-2020, 02:30 PM
Post: #22
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
(09-07-2020 01:26 PM)rprosperi Wrote: Sometimes, it feels like there are more lawyers in here than calculator fans... Math fans, scientists and engineers, all of them tend to value precision, exactness and accuracy and abhor ambiguity. Lawyers, not so much. Regards. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
09-07-2020, 02:36 PM
Post: #23
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
On a 41c used 3 and 6 keystrokes.
|
|||
09-07-2020, 02:42 PM
Post: #24
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
6 keystrokes on HP 48.
Still waiting for Namir's no-key 41 solution It ain't OVER 'till it's 2 PICK |
|||
09-07-2020, 03:02 PM
Post: #25
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
HP67... remember, six keys for a solution using which number from 0 - 9 ?
There are 10 scenarios to be solved here. What is a solution using the number 1 three and exactly three times? Same for 0. Same for 7, etc. I suspect Namir's solution is using no digits at all. That's fine, but does not remove the scenarios above... :-) |
|||
09-07-2020, 03:34 PM
Post: #26
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
50g no digits, 3 steps
|
|||
09-07-2020, 06:39 PM
Post: #27
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
(09-07-2020 03:02 PM)Gene Wrote: HP67... remember, six keys for a solution using which number from 0 - 9 ? Oh well I should have known. Any time I think I understand a problem in math of any kind it means I didn't understand it It ain't OVER 'till it's 2 PICK |
|||
09-07-2020, 09:01 PM
Post: #28
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
My no digits solution is three steps:
Code: 01 pi Without CEIL, it's four steps (on a 41): Code: 01 pi This provides a limit on solutions because the digits can be entered first and ignored: Code: 01 0 I.e. there is a digit independent way of getting the result in six bytes/steps assuming all the used functionality is available on the device in question. Okay, pi isn't permitted since it is a constant but that leads onto: For digits 1 - 9, there is an eight step solution.
Assume the digit is d: Code: 01 d Since we're aiming for the fewest steps, having this limit sets a bar -- not necessarily a very low bar but a bar. This doesn't mean that longer solutions aren't interesting. There is also an eight step solution for the digit 0. On the other end of the scale, we must use each digit thrice and doing so cannot get the answer of 24. Therefore, the minimal program must be 4 or more steps/bytes. I suspect it has to be more than 4 in all cases (but no doubt will be proven wrong). |
|||
09-07-2020, 09:01 PM
Post: #29
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
Embargo - lifted.
For the 41/42 and select other RPN models. 5 ENTER ENTER * DSE X 5 steps , 8 bytes 16 bytes with 1-char global label and an END --Bob Prosperi |
|||
09-07-2020, 09:20 PM
(This post was last modified: 09-07-2020 09:20 PM by Sylvain Cote.)
Post: #30
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display | |||
09-07-2020, 09:47 PM
(This post was last modified: 09-07-2020 09:47 PM by rprosperi.)
Post: #31
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
(09-07-2020 09:20 PM)Sylvain Cote Wrote: Actually not yet, it is 5PM CENTRAL TIME USA Dang. Gene, when are you going to move to the East coast? Anyhow, I'll be on a family monthly zoom then, plus I suspect this is not such an insightful solution that it will ruin anyone's day... --Bob Prosperi |
|||
09-07-2020, 10:51 PM
(This post was last modified: 09-07-2020 11:21 PM by Hlib.)
Post: #32
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
HP-50g, RPN mode. To ensure the least number of keystrokes I`ve made a custom
soft menu for four functions: DUP, SQ(x^2), !(factorial), NOT. { DUP SQ ! NOT } `CST` STO [LS] [MODE] Thus number of steps in the solution match the keystrokes. The universal chain N DUP + N ÷ SQ ! (seven clicks) comes up to every number except zero. But in some particular cases, this can be made more shorter. #9 24=√9×9–√9 || 9 √ 9 × 9 √ – || 7 steps(clicks) #8 24=8+8+8 || 8 DUP + 8 + || 5 steps(clicks) #7 24=(((7+7)÷7)^2)! || 7 DUP + 7 ÷ SQ ! || 7 #6 24=6^2–6–6 || 6 SQ 6 – 6 – || 6 #5 24=5^2–5÷5 || 5 SQ 5 DUP ÷ – || 6 #4 24=4^2+4+4 || 4 SQ 4 + 4 + || 6 #3 24=3^3–3 || 3 DUP y^x 3 – || 5 #2 24=(((2+2)÷2)^2)! || 2 DUP + 2 ÷ SQ ! || 7 #1 24=(((1+1)÷1)^2)! || 1 DUP + 1 ÷ SQ ! || 7 #0 24=... || 0 NOT 0 NOT + 0 NOT ÷ SQ ! || 10 |
|||
09-08-2020, 12:04 AM
Post: #33
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
HP42S, 5 steps:
4.9 ENTER ENTER X IP |
|||
09-08-2020, 12:18 AM
(This post was last modified: 09-08-2020 12:19 AM by Fred Lusk.)
Post: #34
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
I shortened my generic DM-42 program again. Now it is 10 steps. This program takes any single-digit number sitting in the X-register (or any number, positive, negative, or zero, for that matter), makes three copies in the stack (putting the number in X into Y and Z also), then uses all three numbers to create the number 24.
01 LBL "T4" 02 ENTER 03 ENTER 04 + 05 + 06 SIGN 07 RCL+ ST X 08 RCLx ST X 09 N! 10 END If you preload the stack with the same number in X, Y, and Z, then delete steps 02 and 03, which leaves an 8-step program. The following program will take ANY number in the X-register and convert it to 24. It works like the previous program, but it's simpler because it only has to deal with one number. 01 LBL "TF" 02 SIGN 03 RCL+ ST X 04 RCLx ST X 05 N! 06 END ...Fred |
|||
09-08-2020, 12:33 AM
Post: #35
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
My solution for 4 is:
Code: 4 4 ENTER 4 n! The first two 4's and the command after doing nothing. For zero (8 steps): Code: 0 0 COS 0 n! + x^2 n! Pauli |
|||
09-08-2020, 02:49 AM
(This post was last modified: 09-08-2020 02:51 AM by Sylvain Cote.)
Post: #36
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
My solution for value 3 is: (HP-41 → 5 operations, 7 keystrokes, no unused data is left on the stack, Z & T are preserved)
Code: 3 My solution for value 4 is: (HP-41 → 6 operations, lots of keystrokes, no unused data is left on the stack, Z & T are preserved) Code: 4 My solution for value 5 is: (HP-41 → 6 operations, 8 keystrokes, no unused data is left on the stack, T is preserved) Code: 5 Sylvain Edit: typos |
|||
09-08-2020, 03:01 AM
Post: #37
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
(09-08-2020 12:18 AM)Fred Lusk Wrote: I shortened my generic DM-42 program again. ...Brilliant! Here is an adapted version for the HP-41 and which also now preserve Z & T . Code: 01 LBL "T4" Sylvain |
|||
09-08-2020, 04:04 AM
Post: #38
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
Using 1 only once
=========== Code: 1 Using NO Digit ========= Code: CLX |
|||
09-08-2020, 05:22 AM
Post: #39
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
My solution for 2 on the 42S in 6 steps :
Code: 2 |
|||
09-08-2020, 10:51 AM
(This post was last modified: 09-08-2020 10:57 AM by ndzied1.)
Post: #40
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
42S, digit 4, 7 steps, roundabout way. 4! 2 steps.
Code: 4 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)