def collatz(n):
    """
    Returns the Collatz sequence starting from a given number.
    """
    sequence = []
    while True:
        sequence.append(n)
        if n == 1:
            break
        if n % 2 == 0:
            n = n // 2
        else:
            n = 3 * n + 1
    return sequence