Hi all,

After several months' leave of absence, here you are, a new **S&SMC** challenge to

brighten up your HP programming spirit. After challenges #1, #2, ...,

#9, and #10, "who's next" ? #11, you say ? And how on earth did you came to

that bold conclusion ?

Well, that's exactly the purpose of this S&SMC#11, to substantiate that

very conclusion of yours with hard facts ... well, more like 'soft'(ware) facts, actually. Enter

**The challenge**

Try and write a program for any HP model that will accept a

*sequence of numbers*, then produce

its prediction for the

*next*element of the sequence.

For instance:

- Given the sequence
*1,2,3,4,5,6,7,8,9,10*, your program should

produce the value.**11** - Given the sequence
*11,13,15,17,19*, your program should

produce the value.**21** - Given the sequence
*-9,-16,-25,-36*, your program should

produce the value.**-49**

Your program must accept any number of elements (at least 2), then produce

the simplest reasonable prediction for the next element. No provisions

should be taken to predict further elements, just the next one.

Of course, mathematically speaking there's always a choice in selecting the

next element of an arbitrary sequence, as an infinite number of sequences are possible initially having the very same elements. Thus, for instance, the sequence:

0, 1might continue like this:

0, 1 ->or like this:2, 3, 4, 5, ...

0, 1 ->0, 1, 0, 1, ...

among infinite other possibilities. In this particular example, choosing

__2__ for the next element is simplest because in the given sequence, going

from 0 to 1 entails a (+1) increment and lacking any more information it

seems simpler to stay with it than unexpectedly reverse it to (-1) for

no apparent reason. So, given the sequence above (0,1), your program is

expected to predict **2** as the next element, not **0** or any other value.

**Put your program to the test**

Use your program to produce the next element for the following 11 test cases:

**:**11, 13, 15, 17, 19, ?**:**-9, -16, -25, -36, ?**:**8, 27, 64, 125, 216, ?**:**0, 0.01, 0.32, 2.43, 10.24, 31.25, ?**:**2, -3, -4, -1, 6, ?**:***(in radians)*sin(0), sin(0.1), sin(0.2), sin(0.3), sin(0.4), ?**:**Ln(1), Ln(1.1), Ln(1.2), Ln(1.3), Ln(1.4), ?**:**Pieces of pancake (i.e: flat, 2D) obtained by N cuts: 1, 2, 4, 7, 11, ?**:**Maximum number of electrons in layer N: 0, 2, 8, 18, 32, 50, ?**:**Maximum number of pieces of (3D) cake we get with N cuts: 1, 2, 4, 8, 16, ?**:**0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ?

**Deadline**

Midway next week I'll post my solution (plus comments) for the **HP-71B** (which is

a simple, 3-line program) and I'll also provide an **HP-15C** version. You might want to try your hand at it this next weekend.

**Caveat computat:**

Absolutely refrain from using a PC, laptop, or PDA (unless running some HP calc emulator/simulator) to solve the challenge. A Mathematica, Visual Basic, C++, or Java solution is useless to the intended purposes of this challenge, in fact actually defeats them, and submitting one is to be considered unpolite behavior.

And who knows, you might find using your program a useful training for some outdated *'intelligence tests'* ... :-)

Best regards from V.

*Edited: 13 Oct 2005, 8:27 a.m. *