Hailstone Solution (Assignment 2)