def collatz_len(n):
    """Computes the length of the Collatz sequence starting at `n`.

    While this iterative approach might look "unpythonic" at first,
    the Collatz sequence is a very iterative algorithm, and there aren't
    very many easy functional ways to solve this problem.

    One benefit of this approach is that we do not store the entire
    sequence in memory - since we're only interested in the length, that
    would be wasteful.
    """
    length = 1
    while n > 1:
        if n % 2 == 0:
            n //= 2  # We want to explicitly use integer division here, even though n is even.
        else:
            n = 3 * n + 1
        length += 1  # Note: Python has no increment operator (like ++), so we use += 1
    return length