Post Reply 
Challenge: Generate 24 in the X register / display
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
02 e^x
03 CEIL

Without CEIL, it's four steps (on a 41):
Code:
01 pi
02 e^x
03 INT
04 ISG ST X

This provides a limit on solutions because the digits can be entered first and ignored:
Code:
01 0
02 0
03 0
04 pi
05 e^x
06 CEIL

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
02 ENTER
03 d
04 +
05 d
06 /
07 x^2
08 x!

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).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Challenge: Generate 24 in the X register / display - Paul Dale - 09-07-2020 09:01 PM



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