import functools
import math


def get_factors(n):
    """return all factors of an integer

    Parameters
    ----------
    n: int
        integer to factorize

    Returns
    -------
    factors: list
        List of all factors
    """
    step = 2 if n % 2 else 1
    ret = list(
        set(
            functools.reduce(
                list.__add__,
                ([i, n // i] for i in range(1, int(math.sqrt(n)) + 1, step) if n % i == 0),
            )
        )
    )
    ret.sort()
    return ret