implementation of hailstone function which generates a sequence for some n by following these rules n 1 done n is even the next n n2 n is odd the next n 3n 1 return the hailstone sequence from n to 1 n the starting point of the hailstone sequence return the hailstone sequence from n to 1 n the starting point of the hailstone sequence
def hailstone(n):
    

    sequence = [n]
    while n > 1:
        if n%2 != 0:
            n = 3*n + 1
        else:
            n = int(n/2)
        sequence.append(n)
    return sequence