go to previous page   go to home page   go to next page

Answer:

Yes. This is the recursive version of a result-controlled loop.


Hailstone Numbers

An interesting sequence of integers is generated by doing the following: start with any positive integer N and then

For example, if you start with 3 the sequence is

3, 10, 5, 16, 8, 4, 2, 1

If you start with 6 the sequence is

6, 3, 10, 5, 16, 8, 4, 2, 1

This is called a hailstone sequence because the numbers go up and down like hail being tossed about in the wind. If the sequence hits a power of 2, then dividing by two is another power of 2, and so on, so the sequence collapses to 1 and is done.

As far as is known, all hailstone sequences eventually reach 1 and stop. But this has not been proven. (However, it has been tested for integers up to 1018.)


QUESTION 14:

Is this a counting loop (or its recursive equivalent)?


go to previous page   go to home page   go to next page