Post Reply 
Challenge: Generate 24 in the X register / display
09-06-2020, 09:58 PM (This post was last modified: 09-07-2020 12:41 AM by Gene.)
Post: #1
Challenge: Generate 24 in the X register / display
Challenge: Using a single digit repeated 3 and only 3 times, produce the number 24 in the X register.

Details - read them carefully... not trying to be picky, but to lay things out.

You cannot assume any default state of the calculator or the stack. You may not reset the calculator either. :-) Open to any ** HP ** RPN model or RPL model or the 71B with no extensions / plug ins added. No alpha functions allowed either. Stay numeric.

Please STATE which model your solution is for. This should provide a number of possible solutions, so just because someone posts a 2 step solution, please try it yourself.

Note: Solutions are sought for the numbers 0 – 9. Can you use 0 up to three times and generate 24 in the display? Can you use 1 up to three times and generate 24 in the display? Etc.

Embargo on solutions posted until Monday evening 5pm Central Time USA – roughly 24 hours from this post.


Example: A solution for the number 8 (most obviously) could be five steps: 8 ENTER ENTER + + which leaves 24 in the X register. Another solution would be six steps: 8 ENTER 8 + 8 + but that is longer.


Suggested layout of the solutions:

Solution for up to three 1’s. Model HP-25:

1
ENTER

Etc.

Remember to have fun.
Gene
Find all posts by this user
Quote this message in a reply
09-06-2020, 10:25 PM (This post was last modified: 09-07-2020 03:10 AM by Sylvain Cote.)
Post: #2
RE: Challenge: Generate 24 in the X register / display
Edit 1: there was a difference between what was written and what I understood, all my solutions are invalid. Arrggg.
Edit 2: ok 2nd try ...
a) With value 3 → 5 steps on most HP RPN scientific calculators and several RPN financial calculators.
b) With value 5 → 6 steps on most HP RPN scientific calculators and several RPN financial calculators.
Find all posts by this user
Quote this message in a reply
09-06-2020, 10:53 PM
Post: #3
RE: Challenge: Generate 24 in the X register / display
I get 6 steps on an HP41C!

Namir
Find all posts by this user
Quote this message in a reply
09-07-2020, 12:03 AM
Post: #4
RE: Challenge: Generate 24 in the X register / display
For which one Namir ? :-) Remember, please state which numeral you are using up to three times to get 24.

Did you use 0, 1, 2, 3... ?
Find all posts by this user
Quote this message in a reply
09-07-2020, 12:39 AM
Post: #5
RE: Challenge: Generate 24 in the X register / display
Is it allowed to use:
1) some digit less than up to 3 times
2) built-in constants and procedures (HP-50g)
3) SQ or x^2 ?
Find all posts by this user
Quote this message in a reply
09-07-2020, 12:42 AM
Post: #6
RE: Challenge: Generate 24 in the X register / display
Edited original instructions.

Use the same single digit 3 and only 3 times.

No built in constants (don't think the 50g has 24 built in but ... ?)

and things like X^2 etc are fine.
Find all posts by this user
Quote this message in a reply
09-07-2020, 01:13 AM
Post: #7
RE: Challenge: Generate 24 in the X register / display
(09-07-2020 12:42 AM)Gene Wrote:  Use the same single digit 3 and only 3 times.

Hlib question still remains: can we use a digit less than 3 times, or should it be exactly 3 times ?

Also, do you consider Pi a built-in constant ? Because in the HP-71B it is a function.

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
09-07-2020, 01:26 AM
Post: #8
RE: Challenge: Generate 24 in the X register / display
Use a single digit repeated 3 and only 3 times and a required total of 3 times. All solutions should incorporate the use of a single digit - the same digit - three times.


PI on the HP-71B is allowed. I suspect it to be a "constant" elsewhere, but I won't worry too much about PI. Use it if you wish, but you must include three instances of 0 or 1 or 2...whichever solution you are providing. Just covering my bases should a 24 be included as some sort of constant for some reason! :-)
Find all posts by this user
Quote this message in a reply
09-07-2020, 01:49 AM (This post was last modified: 09-07-2020 04:00 AM by Monte Dalrymple.)
Post: #9
RE: Challenge: Generate 24 in the X register / display
41C:

0: 11 (14 keystrokes)
1: 8 (9 keystrokes)
2: 5
3: 6 (7 keystrokes)
4: 6 (7 keystrokes)
5: 7 (8 keystrokes)
6: 6 (7 keystrokes)
7: 11
8: 6
9: 8

But I am rusty at this... and I assumed no other digits were allowed, just the selected digit 3 times. All these counts include the three keystrokes for the number.
Visit this user's website Find all posts by this user
Quote this message in a reply
09-07-2020, 02:24 AM (This post was last modified: 09-07-2020 02:40 AM by rprosperi.)
Post: #10
RE: Challenge: Generate 24 in the X register / display
5 steps using 5 on any 41/42 and some other programmable RPN machines

Edit: Cut a step, 6 -> 5

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-07-2020, 02:26 AM
Post: #11
RE: Challenge: Generate 24 in the X register / display
(09-07-2020 01:26 AM)Gene Wrote:  Use a single digit repeated 3 and only 3 times and a required total of 3 times. All solutions should incorporate the use of a single digit - the same digit - three times.

Understood.

However, unless you forbid it explicitly, to use a number just 2 times, say, and still be within your current rules, you simply enter the first instance, ignore it altogether, then use just the second and third instances,.

Thus, I'd suggest allowing solutions with up to 3 instances of the digit. Or else explicitly forbid entering an instance and doing nothing whatsoever with it. Smile

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
09-07-2020, 02:42 AM
Post: #12
RE: Challenge: Generate 24 in the X register / display
(09-07-2020 02:26 AM)Valentin Albillo Wrote:  However, unless you forbid it explicitly, to use a number just 2 times, say, and still be within your current rules, you simply enter the first instance, ignore it altogether, then use just the second and third instances,.

Thus, I'd suggest allowing solutions with up to 3 instances of the digit. Or else explicitly forbid entering an instance and doing nothing whatsoever with it. Smile

Shhh.....

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-07-2020, 03:26 AM
Post: #13
RE: Challenge: Generate 24 in the X register / display
Monte said: "and I assumed no other digits were allowed, just the selected digit 3 times."

Gene: This is correct.
Find all posts by this user
Quote this message in a reply
09-07-2020, 03:30 AM
Post: #14
RE: Challenge: Generate 24 in the X register / display
I also found a solution that requires NO digits!!!

:-)

Namir
Find all posts by this user
Quote this message in a reply
09-07-2020, 05:25 AM (This post was last modified: 09-07-2020 05:42 AM by Fred Lusk.)
Post: #15
RE: Challenge: Generate 24 in the X register / display
Gene...

I think the first sentence in this challenge should say "single digit number repeated 3 and only 3 times", not "single digit repeated 3 and only 3 times". The challenge as written could just as well mean 000, 111, 222, etc., although the rest of the challenge statement indicates otherwise.

Using my DM42, I made a generic solution that can solve this challenge for three 0s, three 1s, three 2s, all the way to up to three 9s. The program totals 16 steps, including label and END. I took the approach that the program would accept a single digit number (0-9) in the x-register, then ENTER twice to get all three numbers required for the challenge into X, Y, and Z (this is two steps of the program). I then used all three of these numbers and no digit keys whatsoever. If I enter all three numbers into the stack first, then the program shrinks to 14 steps.

I'm sure a better generic solution exists and I will keep plugging away at it.

// EDIT: Now down to 12 steps, including the two ENTERs at the beginning. //

Fred
Find all posts by this user
Quote this message in a reply
09-07-2020, 05:26 AM
Post: #16
RE: Challenge: Generate 24 in the X register / display
(09-07-2020 03:30 AM)Namir Wrote:  I also found a solution that requires NO digits!!!

How many steps/bytes/keystrokes/functions? CEIL(e^pi) springs to mind immediately.

I've a 5 operation / 6 keystroke version for '4' that works on all scientifics apart from the 35 and 21. It also works on business models from the SPICE series onwards.

Pauli
Find all posts by this user
Quote this message in a reply
09-07-2020, 05:38 AM
Post: #17
RE: Challenge: Generate 24 in the X register / display
Namir...

I also found a solution that doesn't require any digits. It's currently at 8 steps on the DM42.

Fred
Find all posts by this user
Quote this message in a reply
09-07-2020, 08:17 AM
Post: #18
RE: Challenge: Generate 24 in the X register / display
> Remember to have fun.

Great advice! Nice challenge too.
Find all posts by this user
Quote this message in a reply
09-07-2020, 09:23 AM (This post was last modified: 09-07-2020 05:41 PM by Hlib.)
Post: #19
RE: Challenge: Generate 24 in the X register / display
HP-50g, RPN mode:
Universal algorithm: 8 7 steps by 8 7 keystrokes
for any digit except zero. Only arithmetic
operations are used and all the rules of the challenge are met.
EDIT:
#9 || 7 steps(clicks)
#8 || 5 steps(clicks)
#7 || 7 ...
#6 || 6 ...
#5 || 6 ...
#4 || 6 ...
#3 || 5 ...
#2 || 7 ...
#1 || 7 ...
#0 || 10 ... steps(clicks)
Find all posts by this user
Quote this message in a reply
09-07-2020, 12:16 PM
Post: #20
RE: Challenge: Generate 24 in the X register / display
Reminder to ttw and others... please do not post solutions until after the deadline.
Find all posts by this user
Quote this message in a reply
Post Reply 




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