Hi all, a new month begets a new S&S Math Challenge, #7 to be precise.

This time you'll have to use to the max all your math intuition,

skills, a lot of sleuthing, and a respectable amount of programming

ingenuity though, as always, the required program won't be neither

too difficult nor too long.

I can assure you that the answer to this particular challenge will

take you *absolutely by surprise*, you'll be *enthralled* by the

discovery process, then absolutely *delighted* with the unexpected

outcome. Matter of fact, you might want to tackle this challenge all by yourself, refraining from reading any posts in this thread till you find the solution on your own, so as to avoid spoiling the (considerable) pleasure. This is truly one of a kind, trust me !

So, it seems this would be reward enough for any HP/Math fan, right ?

Well, no. Just in case this isn't enough for you, there's yet another interesting (if material)

reward: a high-quality 1280 x 1024 image of this fabulous classic

"poster", scanned by myself, depicting three Classical and Woodstock

HP machines against an ancient pyramidal background, have a look at this small thumbnail:

This magnificent 1280 x 1024 image will be awarded to the first person (or persons, eventually)

who comes out with a working program and correct answers to the questions

raised by

**The Challenge**

This Challenge is structured in two parts. *First*, you must write

a program to compute a given function. *Then*, you must use your

program *and* intuition to answer a number of preparatory, training

questions about the function, ending in a **Big Question[tm]** which will require all your sleuth abilities as well as data

gathered from the answers to the training questions.

**First part: The Program**

Use your favorite HP calculator (most any will do) to implement the

following function **h(n)**, defined __for integer n greater
than 0__ as follows:

h(1) = 1Your program must accept

h(3) = 3

h(2n) = h(n)

h(4n+1) = 2*h(2n+1)-h(n)

h(4n+3) = 3*h(2n+1)-2*h(n)

**n**as input and return

**h(n)**as output,

where n is an arbitrary integer greater than 0.

If you succeed, you'll be in a most favorable position to answer the following *training* questions, which will increase your chances of finding a correct answer to the ultimate last question.

**Second part: The Questions**

Use your program to compute **h(n)** and a little sleuthing to

answer these training questions, *in order*. They are designed

to led you effortlessly, step by step, to the **Big Question[tm]**.

(m and n are always arbitrary integers greater than 0).

- What's the value of h(2
^{n}) ? ditto h(2^{n}+ 1) ? h(2^{n}- 1) ? h(m * 2^{n}) ? - For which n is h(n) = 100 ?
- For which n is h(n) even ?
- If n is odd and m = h(n), what's the value of h(m) ?
- What are the values of h(h(n)) ?
- For which values of n do we get h(n) = n ?

**Second part encore: The Big Question [tm]**

**Just what on Earth does h(n) to n ??**
This is, describe the simplest relationship the result value has

with the given argument. In English (or Spanish) you can state

this relationship unambiguously using just ** three words**. Which ones ?

**Notes:**

In order to check that your program delivers correct results

for h(n), you might try to check out the following random cases:

n h(n)

------------

841 587

642 261

44 13

821 691

381 381

17 17

378 189

226 71

86 53

742 413

765 765

514 257

Give it a try, I'm sure you'll enjoy it ! :-)

Best regards from V.