An (HP-15C, HP-...) mini-quiz « Next Oldest | Next Newest »

Hi, all:

As the Forum's really quiet these past few days, I think you'll welcome
the opportunity to engage this little mini-quiz I've concocted in a hurry for your
leisurely HP-calc pleasure. It's quite simple, actually:

## The mini-quiz

Assuming the correct FIX mode to display the decimal places shown,
and assuming nothing else unless otherwise stated, find the minimum number of steps required to generate the following displays:

```----------------------------------------------------------------------
Display    Extra assumptions, if any          My HP-15C solution
----------------------------------------------------------------------
-0.1416    assume 42 is in X, can't use Pi       3 steps
0.1717    assume master-cleared machine         2 steps
0.1122    assume master-cleared machine         4 steps
1.43143    assume nothing else                   4 steps
22.755533    assume nothing else                   5 steps
----------------------------------------------------------------------
```
For the purposes of this mini-quiz, a 'step' is defined as any
sequence of keystrokes that could be stored in a single program step if
programmed, no matter how many or how few keystrokes it does take.
For instance, to achieve a 0.5678 display, assuming nothing but
the proper FIX 4 display mode, an allegedly minimum solution would be:
```           31, SQRT, FRAC  ->  0.5678
```
which is four steps long: 3, 1, SQRT, f FRAC

Though this mini-quiz is intended for the HP-15C, and I'll give
my original solutions in the stated number of steps exclusively for this specific machine, you can
try your hand with any other classic HP calc models such as the 11C, 34C, etc. Newer models such as the 41C or 42S, say, that can store a whole multi-digit number in a single program step are not eligible, as the quiz is utterly trivial for them, of course.

I'll post my solutions next Monday. Enjoy, see what you can do and ...

Best regards from V.

Edited: 5 Oct 2006, 9:15 a.m.

Hello Valentin,

The easiest ones first:

Assuming ON/- has just been executed:

```
RAN# ->H  -> .1717
6.4 TAN   -> .1122
```

Regards,

Gerson

I'm impressed, but what made you think of

RAN# ->H -> .1717

Mike T.

Because Valentin asked us to assume a master-cleared machine, I thought he'd used trigs in degrees mode. I imagined also he might have used RAN# because this would also require resetting the calculator to its initial condition (assuming the random number generator seed to be zero would be too obvious :-). Doing this (0 STO #RAN) makes the first random number to be 0.101798. Then it was just a matter of finding a function that turned .1018 into .1717 (I should have noticed that 10 minutes = 0.1667 hours and tried ->H at first, but that was not necessary as the third or fourth function I tried worked...)

Gerson.

Quote:

```    0.1122    assume master-cleared machine         4 steps
```

A couple of other ways to achieve this one:

```    4 1 SQRT TAN
PI 2 8 /
```

- Pauli

Quote:
```----------------------------------------------------------------------
Display    Extra assumptions, if any          My HP-15C solution
----------------------------------------------------------------------
-0.1416    assume 42 is in X, can't use Pi       3 steps
```

A little progress on this one. If we're in radians or complex mode then these two sequences work out but don't use the 42 on the stack:

```    3 TAN ATAN
or  3 TAN TANH
```

Get the result. I don't see how to get the calculator into radians or complex mode without an extra keystroke (RAD, I or Re<>Im).

In degrees mode this sequence is pretty neat but still too long:

```    SIN SINH LOG TANH
```

- Pauli

Edited: 10 Oct 2006, 3:42 a.m.

Quote:
```----------------------------------------------------------------------
Display    Extra assumptions, if any          My HP-15C solution
----------------------------------------------------------------------
1.43143    assume nothing else                   4 steps
```

My best so far for this is the five sequence:

```    9 TAN SINH 9 *
```

which assumes both degrees and that we are not partially through entering a number. Neither is allowed by a strict interpretation of the rules.

- Pauli

Quote:
For instance, to achieve a 0.5678 display, assuming nothing but
the proper FIX 4 display mode, an allegedly minimum solution would be:
```           31, SQRT, FRAC  ->  0.5678
```
which is four steps long: 3, 1, SQRT, f FRAC

Since I'm not making progress on the other problems, I had a stab at the example. I've found two other four step sequences but none shorter:

```    3 1 ->RAD SINH
&   3 7 TAN x^2
```

The latter assumes degrees mode so it isn't as good.

- Pauli

Are we going to see the solutions to this quiz?
Monday has twice past.

- Pauli

Certainly, certainly ! ...

I've been out and about and just completely forgot about this simple mini-quiz which, as stated, I concocted on the fly to try and cheer up the forum at a time where new postings were really scarce.

The forum's been much livelier since then, and I've been too busy so I simply forgot about it, sorry. Anyway, here you are, my original solutions:

```  -0.1416    assume 42 is in X, can't use Pi       3 steps
STO RAN#, RAN#, LOG         => -0.1416

0.1717    assume master-cleared machine         2 steps
RAN#, ->H                   =>  0.1717
0.1122    assume master-cleared machine         4 steps
RAN#, SIGMA+, RCL 3, RCL+4  =>  0.1122

1.43143   assume nothing else                   4 steps
PI, STO RAN#, RAN#, COSH    =>  1.43143

22.755533  assume nothing else                   5 steps
PI, GAMMA, STO RAN#, RAN#, ->DEG  =>  22.755533
```

All of them work also on an HP-11C, except the one using RCL
arithmetic that the HP-15C implements but the HP-11C doesn't.

You may also notice that all my solutions make use of the
random number functionality, which is identical for both models except that you can use RCL RAN# in the HP-15C to recall the seed actually stored in the internal RAN# register, which isn't possible in the HP-11C. Anyway, none of my solutions rely on this particular instruction.

Thanks for your interest, sorry for the delay, and

Best regards from V.

Hello Valentin,

I thought of RAN#, SIGMA+, RCL 3, and RAN#, SIGMA+, RCL 4 , but never of something like RCL+4... I also tried the sequence STO RAN#, RAN#...

Just to show you I tried see this:

`.48 1/x COSH x! LOG        => 1.43143 `

or

`.8 ->HMS 1/x COSH x! LOG   => 1.43143 `

Seven steps though. It would have been much better if I just entered the constant :-)

These tricks were important to save a few steps on these old calculators. They were useful even on the not so old HP-32SII. For instance, in one of my 32SII programs I used at work I needed the constant 0.1965. I remember I used 2, 1/x, -> in instead of simply 0.1965. That was two steps longer but 5 bytes shorter (the 0.2% difference didn't matter). That was important in a 384-byte calculator (not on the HP-33S though).

As of quizzes, these are easy to create, but difficult to solve (if no clues are given :-)

```22.75555555    (6 steps)
6.665555      (3 steps)```

Assume nothing but the display format. They work also on the HP-11C. The latter doesn't work on the HP-33C. None works on the HP-12C. A math constant is needed in both (guess what!).

Best regards,

Gerson.

Edited: 17 Oct 2006, 10:24 p.m.

Quote:
```22.75555555    (6 steps)
6.665555      (3 steps)```

Only tried the first so far but how are these possibilities:

```    3 2 x^2 4 5 /
3 2 x^2 1 ATAN /
```

The second requires degrees mode.

Also interesting are:

```    2 ATAN 7 x^2 %change CHS
2 ATAN 4 9 %change CHS
```

In either case, CHS could be replaced by absolute value.

- Pauli

Quote:
```    3 2 x^2 4 5 /
3 2 x^2 1 ATAN /```

These are fine. Only we don't want the final '6' :-)

(Of course this wouldn't be a problem in real world, and still would be one step shorter than the equivalent fraction).

My solution involves squaring a two-digit integer first (or twice squaring a one-digit integer), as yours, and requires PI too, as I said. Your solution to the second problem obviously matches mine!

Gerson.

Edited: 18 Oct 2006, 12:31 p.m.

Quote:
These are fine. Only we don't want the final '6' :-)

Oops, miscounted the 5's :-(

```    8 x^2 x^2 ->RAD pi /
```

where the 8 x^2 can be replaced by 64 if desired.

Interestingly these two permutations have a trailing '6' digit:

```    8 x^2 x^2 pi / ->RAD
8 x^2 x^2 pi ->DEG /
```

- Pauli

Quote:
8 x^2 x^2 ->RAD pi /

Bingo! Next time I will give no tips. (I am kidding, there won't be more of these.)

Quote:
Interestingly these two permutations have a trailing '6' digit:
```    8 x^2 x^2 pi / ->RAD
8 x^2 x^2 pi ->DEG /
```

This is a case where the less accurate result was better :-)

Regards,

Gerson.

Quote:
` 6.665555      (3 steps)`

Figured out this one too:

```    PI ->H.MS x!
```

- Pauli

Edited: 18 Oct 2006, 5:31 a.m.

 Possibly Related Threads... Thread Author Replies Views Last Post HPCC Mini Conference 2013 hugh steers 6 465 09-13-2013, 04:27 PM Last Post: BruceH Picture from the Mini-HHC (LA) Geir Isene 11 705 07-07-2013, 01:06 PM Last Post: Jim Horn My birthday, so a little commemorative mini-challenge ! Valentin Albillo 43 2,152 03-07-2013, 03:44 AM Last Post: Walter B WP 34S mini-challenge (B) Gerson W. Barbosa 17 896 12-27-2012, 04:39 PM Last Post: Marcus von Cube, Germany Mini-challenge: HHC2012 RPL programming contest with larger input David Hayden 14 885 10-05-2012, 10:36 PM Last Post: David Hayden HP-41 Quiz: How to pack 100k in ROM? (on-line) Ángel Martin 10 650 09-02-2012, 10:35 PM Last Post: Luiz C. Vieira (Brazil) HP41 / SY41CL Mini-B USB Power Connector (Module) Matt Kernal 5 1,166 07-08-2012, 06:23 PM Last Post: Diego Diaz HP-15C (& LE!) 11-11-11 Mini-Challenge Valentin Albillo 28 1,335 11-14-2011, 08:12 AM Last Post: Valentin Albillo Mini challenge. CEIL / FLOOR in RPN M. Joury 47 2,297 10-31-2011, 10:11 AM Last Post: M. Joury Photo of my HP 15c | 15c LE DigiGal 2 315 10-12-2011, 12:34 PM Last Post: DigiGal

Forum Jump: