import math


def factor(n):
    """Simple factorization function. Makes sure to only try each number once."""
    factors = []
    for i in range(2, int(math.sqrt(n)) + 1):
        if i not in factors and not n % i:
            factors.append(i)
            factors.append(n / i)
    return factors