import typing


def prime_factorize(n: int) -> typing.List[int]:
    """Prime factorization

    trial division

    Parameters
    ----------
    n
        max n < 10**12

    Returns
    -------
        list of factor

    Notes
    -----
    Time complexity

    O(√n)

    References
    ----------
    ..[1] https://en.wikipedia.org/wiki/Trial_division

    Examples
    --------
    >>> prime_factorize(24)
    [2, 2, 2, 3]
    """
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res