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, 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 |
|||
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:
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 |
|||
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 |
|||
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. |
|||
09-08-2020, 04:56 PM
Post: #46
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display | |||
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: Oops, think I was sidetracked by the exception for PI. HP42S, 6 steps using 4 three times: OCT 4 ENTER ENTER X + |
|||
09-08-2020, 08:32 PM
Post: #48
|
|||
|
|||
RE: Challenge: Generate 24 in the X register / display
Found new ideas
1) 5 steps Code:
2) 3 steps Code:
3) 4 steps Code:
4) 6 steps Code:
5) 7 steps Code:
6) 5 steps Code:
7) 8 steps Code:
8) 5 steps Code:
9) 7 steps Code:
10) 10 steps Code:
Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co |
|||
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 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
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:
Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co |
|||
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 || |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)