from typing import Collection


def A006577(start: int = 0, limit: int = 20) -> Collection[int]:
    """Number of halving and tripling steps to reach 1 in '3x+1' problem,
    or -1 if 1 is never reached.
    """

    def steps(n: int) -> int:
        if n == 1:
            return 0
        x = 0
        while True:
            if n % 2 == 0:
                n //= 2
            else:
                n = 3 * n + 1
            x += 1
            if n < 2:
                break
        return x

    return [steps(n) for n in range(start, start + limit)]