▼
Posts: 142
Threads: 24
Joined: Jan 1970
Hi, everybody.
To cheer the forum up a little, here's a nice challenge
I've come up with for all you fans of the awesome Voyager Series' HP15C calculator. Take yours from the safe and use your
timeproven ingenuity to try and solve this challenge:
Initial conditions:
 Assume a newly reset machine (i.e.: no specific angular
or display mode, no specific contents in any register or
program memory)
 Start with the value of PI (3.141592654) displayed
in the Xregister
The Challenge:
You must try and get the value PI/10
(i.e: 0.3141592654) in the Xregister, subject to these
Conditions:
 you cannot use any numbered registers (R00 thru R65)
 you cannot use numberentry keys (0,1,...9, ., EEX, CHS)
 you cannot use arithmetic operators (+,,*,/)
 you must try to minimize the bytecount for the operations performed
If you find it too hard, I suggest you first try to solve it subject to a subset of conditions 1,2,3,4 above. For the full challenge (all four conditions simultaneously met), unlikely as it seems, there's a solution in as few as two bytes !
The first solution posted will get an autographed
jpeg of my 'hero' HP15C :)
[By the way, does your solution work for values other than
PI, such as e (=2.718281828...) or the square root of 5 ? ;)]
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
I'm stuck.
What makes the HP15C elected for the task instead of the HP11C? Complex Mode, Matrices, SOLVER and Numerical Integration.
Let's verify initial conditions: Pr Error and [f][PI].
Cannot be Matrices, because the simple access to any element demands matrix creation and number entering. But if we create a 1X1 matrix with [f][MATRIX]1... Oops, R0 and R1 are used. SOLVER and Numerical integration demand programming and number entering as either starting roots or upper and lower limits, despite the fact that the program itself is byte consuming.
Activating complex mode uses at least 1 byte ([f][Re<>Im] or [f][I]) unless you burn the two bytes with [g][CF][8]... Oops, numbers not allowed.
Based in the fact that there is a twobytes solution, this leads us to a single onebyte instruction to solve the problem! Well, this is true only if I am correct in my reasoning, otherwise everything else in the HP15C, under the conditions above, is also available in the HP11C.
I want to know how to do it!
Still stuck.
▼
Posts: 1,477
Threads: 71
Joined: Jan 2005
Here's a 3 byte solution that will work on almost any RPN calculator for any number:
ENTER, %, SQRT
▼
Posts: 776
Threads: 25
Joined: Jun 2007
Why does Katie's solution work?
I don't have a manual handy, but the operation of the % key seems very strange (at least in RPN). As near as I can tell from trying several examples on a '41CX, if you ENTER a number, then enter a second number, and then do "%", you get the product of the two numbers times 0.01. I wouldn't call that a per cent operation. (Given that this is what happens, then taking the square root of the 0.01 factor gives ExPPC's desired factor of 0.1) If the second number you enter happens to be 100, then the % operation makes sense  but not otherwise. Am I missing some fundamental math here?!?! I would have expected the % key to give what per cent the X register is of Y (or viceversa).
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hi;
if you compute X% of X, you have:
x × x

100
or
x^2

100
Think of 10% of 10:
10 × 10

100
or
10^2
 = 1
100
The square root of X% of X is:
x

10
It took me a while to figure it out, too. A very good demonstration of knowledge from our dear contributor.
Thank you, Katie.
Cheers.
Posts: 14
Threads: 1
Joined: Jan 1970
Long solution:
Starting with PI in x register
x<>y
10^x
10^x
g %
▼
Posts: 1,107
Threads: 159
Joined: Jan 1970
First stop:
Assuming PI is in display.
ENTER SIGMA+ 10^x %
four steps, but I haven't given up.
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hi, Gene;
ExPPC asked not to use registers... and [Sigma+] uses them. Just a reminder. Anyway, if he did that, he already knows he can't.
Cheers.
▼
Posts: 25
Threads: 2
Joined: Jan 1970
One answer is:
STO RAN#
RCL RAN#
I think this is unique to the HP15C in how it stores a seed number for the next random number generation. It will do this for any number, not just Pi. For example, 5.235 in the xregister becomes 0.5235.
▼
Posts: 142
Threads: 24
Joined: Jan 1970
Congratulations !! :)
This is the the *exact* answer to my challenge.
I've always found it somewhat curious that such infrequently
used instructions as STO #RANDOM and RCL #RANDOM are
*one byte* in length, instead of twobyte. I guess this
is because all actual twobyte instructions in the set
are of the 'prefix' kind, i.e: STO+, STO, CF n, SF n,
INTEGRATE a, SOLVE b, etc., so there were no candidates
to use these two remaining onebyte codes.
By the way, STO #RANDOM and RCL #RANDOM do not
divide by 10 numbers in the range [0..1), they come out
unaltered. So, this internal register can be perfectly
used to store constants in that range, thus saving a
valuable register (numbered or allocated from the pool)
or 7 program bytes, at no cost ! This works fine as long
as no random numbers are needed in the routine. I've
used this technique in some of my programs for the 15C,
and sometimes it was the only way to
fit the program in the available memory :)
Your correct entry is the first one which meets all four
requirements, while minimizing the byte count, so I will be very
pleased to send you the 'prize' via email, if only I had
some email address of yours ... :)
▼
Posts: 25
Threads: 2
Joined: Jan 1970
Keep the picture  send me the calc! ;)
Posts: 172
Threads: 21
Joined: Sep 2005
I don't have a solution, but analysing the above proposals (regardless of that weird store/recall random#) I must say:
Katie, you are simply the best!!
IMHO, the solution she has given is the most elegant one...
▼
Posts: 99
Threads: 9
Joined: Apr 2013
I agree with Nenad Vulic: Katie's solution was the most elegant.
I tried to do it by subtracting 1 from the log, but couldn't do it within the constraints of the problem.
LC
Posts: 4,027
Threads: 172
Joined: Aug 2005
▼
Posts: 1,477
Threads: 71
Joined: Jan 2005
Thank you all!
That's high praise, coming for the likes for such HP fanatics as yourselves, really!
Katie
