This is the task:
This puzzle involves sequences of integers known as Hailstone sequences. A Hailstone sequence begins with any positive integer and continues until it reaches 1. When a positive integer n (other than 1) appears in a Hailstone sequence, the integer that follows it is determined by the following rule:
If n is even, the next integer is n/2.
If n is odd, the next integer is 3n+1.
Here are a couple of examples. The Hailstone sequence beginning with 6 is
6, 3, 10, 5, 16, 8, 4, 2, 1
The Hailstone sequence beginning with 7 is
7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1
Hailstone sequences are intriguing to mathematicians. No one has ever found a Hailstone sequence that goes on forever and never bottoms out at 1. On the other hand, no one has ever proven that such a sequence cannot exist.
Hailstone sequences get their name from the way that the numbers rise and fall before they finally make it all the way down to 1. And they can get really high before they crash back down. (So high, in fact, that 32-bit integers are too small for some of the questions that are coming up!)
Your job is to answer the following questions about Hailstone sequences. You will almost certainly need to write some simple computer programs. If you aren't a programmer, please feel free to enlist the help of someone who is. When you post your log, please let us know what programming language you used.
1. L(n) stands for the length of the Hailstone sequence beginning with n. For example, L(6) = 9 and L(7) = 17. What is L(7450)?
2. If you make a list of all the integers n for which L(n) = 140 and sort it into ascending order, the first number in the list will be 731 and the second will be 737. What is the 47th number in the list?
3. S(n) stands for the sum of all the numbers in the Hailstone sequence beginning with n. For example, S(6) = 55 and S(7) = 288. For what integer n does S(n) = 472151?
4. H(n) stands for the number of times the Hailstone sequence beginning with n reaches its record high—a number higher than any it has reached before. (The starting point does not count as a record high.) For example, H(6) = 2 and H(7) = 3. What is H(140394587)?
5. If you make a list of all the integers n for which H(n) = 20 and sort it into ascending order, 6887 will occupy position 1 on the list, 8161 will occupy position 2, and 39935 will occupy position 10. What position will 979547 occupy?
I did the first two but i don't know how to do #3,4,5. PLEASE HELP ME!YOUR HELP WILL BE GREATLY APPRECIATED!!