Post Reply 
Challenge: Generate 24 in the X register / display
09-08-2020, 01:40 PM
Post: #41
RE: Challenge: Generate 24 in the X register / display
(09-08-2020 12:04 AM)Dwight Sturrock Wrote:  HP42S, 5 steps:

4.9
ENTER
ENTER
X
IP


Gene: That does indeed generate 24, but does not satisfy the basic rule on the initial post.

"Using a single digit repeated 3 and only 3 times..."

4.9 is not a single digit between 0 and 9.
Find all posts by this user
Quote this message in a reply
09-08-2020, 03:09 PM
Post: #42
RE: Challenge: Generate 24 in the X register / display
.
Hi, Gene & all:

Quote:Challenge: Using a single digit repeated 3 and only 3 times, produce the number 24 in the X register


As no one has submitted a solution for the HP-71B (as if !), here's a generic one I've created for it:

      DISP USING "^,DD";(digit+digit)/digit,FACT(RES+RES)

                   24

Simple as it is, notice the following:

      - it meets all requirements but as the HP-71B doesn't have an "X register" it simply puts 24 in the display
      - it works in any FIX, SCI or whatever mode so it puts in the display 24, not 2.4000E1 or 24.00
      - it doesn't use any other numbers at all, nor any variables
      - as per the requirements, it works for digit = 1,2,3,..., 9, but also you can replace digit by most any number, be it Pi, Sqrt(5), e^Pi^Pi, ...-, except digit = 0
      - for digit = 0, substitute digit above by, say, EXP(digit) or COS(digit), and there you are.
      - also, RES+RES could be instead RES*RES, RES^RES, and other variants.

This solution can be adapted easily to most RPN models, for instance:

      digit, ENTER, digit, +, digit, / , x^2, FACT

Thanks for the challenge 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
09-08-2020, 03:38 PM
Post: #43
RE: Challenge: Generate 24 in the X register / display
My apologies for this answer: I did not have the time to participate, and before reading the above answers I post mine. Sorry if I’m repeating answers or giving some already found (and I guess I’m far from the best answers).
Tested on HP42s but did not want to use STO+X to make it work on 15c or other classic RPN.

That said, here are my attempts:
Code:

1 10^x 1 + 1 + ENTER +
2 10^x 2 / 2 / DSE
3 3 x^y 3 -
4 4 + 4 x^2 +
5 5 5 * DSE
6 6 6 + ENTER +
7 7 * 7 SQRT IP / IP
8 8 + 8 +
9 9 + LASTX + 9 SQRT -
0 0 10^x 10^x 0 e^x e^x * LASTX - IP

Now I can’t wait to see the answers for 9 and 0!

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-08-2020, 04:00 PM
Post: #44
RE: Challenge: Generate 24 in the X register / display
And now I’ve read the above messages and noticed that the rules, apparently clear and simple, were not.
Was it asked to find a solution for each digit from 0 to 9 as I did, or the best solution using 1 of the digits?
I also understand that each digit had to be used 3 and only 3 times, and I respected the rule with a few cheating, letting the unused digits on the stack (ie. 5).

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-08-2020, 04:21 PM
Post: #45
RE: Challenge: Generate 24 in the X register / display
The goal was to use each digit exactly 3 times, no more and no less.

Ideally 10 solutions, one for 0 through 9.

A general solution is possible - get a number 4 showing in the display and use FACT or n! (if available on the model) to get to 24, but that may be more steps than another solution.
Find all posts by this user
Quote this message in a reply
09-08-2020, 04:56 PM
Post: #46
RE: Challenge: Generate 24 in the X register / display
A solution for 7, on the 42S, in 6 steps:
Code:
7
x^2
7
RCLx ST L
%
IP

(09-08-2020 04:21 PM)Gene Wrote:  The goal was to use each digit exactly 3 times, no more and no less.
So I assume that the RCLx ST L above is counting as the third use of the digit 7 .
Find all posts by this user
Quote this message in a reply
09-08-2020, 06:01 PM
Post: #47
RE: Challenge: Generate 24 in the X register / display
(09-08-2020 01:40 PM)Gene Wrote:  
(09-08-2020 12:04 AM)Dwight Sturrock Wrote:  HP42S, 5 steps:

4.9
ENTER
ENTER
X
IP


Gene: That does indeed generate 24, but does not satisfy the basic rule on the initial post.

"Using a single digit repeated 3 and only 3 times..."

4.9 is not a single digit between 0 and 9.

Oops, think I was sidetracked by the exception for PI.

HP42S, 6 steps using 4 three times:

OCT
4
ENTER
ENTER
X
+
Find all posts by this user
Quote this message in a reply
09-08-2020, 08:32 PM
Post: #48
RE: Challenge: Generate 24 in the X register / display
Found new ideas Smile

1) 5 steps
Code:

11
1
+
ENTER
+

2) 3 steps
Code:

22
2
+

3) 4 steps
Code:

33
3
X^2
-

4) 6 steps
Code:

44
4
x^2
LASTX
+
-

5) 7 steps
Code:

5
5
*
5
ENTER
/
-

6) 5 steps
Code:

66
LN
INT
6
*

7) 8 steps
Code:

7
7
*
7
SQRT
INT
/
INT

8) 5 steps
Code:

8
8
+
8
+

9) 7 steps
Code:

9
SQRT
9
*
9
SQRT
-

10) 10 steps
Code:

00
10^x
10^x
0
e^x
e^x
*
LASTX
-
IP

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-09-2020, 06:39 AM
Post: #49
RE: Challenge: Generate 24 in the X register / display
(41, 42) generic solution for d=1..9, shamelessly borrowing pinkman's idea:

Code:
 dd
 d
 ST+ Y
 /
 ST+ X
Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
09-09-2020, 04:29 PM (This post was last modified: 09-09-2020 04:30 PM by pinkman.)
Post: #50
RE: Challenge: Generate 24 in the X register / display
Excellent! This uses dd/d=11, thus (dd+d)/d=12
The same for 15c and others without STO X function:

Code:

dd 
d
+
LASTX
/
ENTER
+

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-09-2020, 08:14 PM
Post: #51
RE: Challenge: Generate 24 in the X register / display
(hp-50)
#1 || 1 10^x EULER 1 %T 1 – ||
#2 || 2 DUP DUP ➝LIST ΣLIST ! ||
And a general solution for any three equal numbers
(including zero) placed on the stack:
|| N DUP DUP MAX SAME 10^x EULER ! ||
or
|| N DUP DUP MAX SAME 10^x √ e^x CEIL ||
Find all posts by this user
Quote this message in a reply
Post Reply 




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