def factor(n):
    """Factor n."""
    l = []
    while n != 1:
        for i in range(2, n+1):
            if n % i == 0:
                n //= i
                l.append(i)
                break
    return l