The hailstone sequence starting at an integer $n > 0$ is generated by the repeated application of the three rules:
(a) Write a program to calculate the hailstone sequence starting at 27.
(b) Let the stopping time be the number of numbers in a given hailstone sequence. Modify your hailstone program to return the stopping time instead of the numbers themselves. Adapt your program to demonstrate that the hailstone sequences started with $1 \le n \le 100$ agree with the Collatz conjecture (that all hailstone sequences stop eventually).
To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.