def divide_equally(n):
    if n < 3:
        return [n, 1]
result = list()
for i in range(1, int(n ** 0.5) + 1):
    div, mod = divmod(n, i)
if mod == 0 and i != 1 and div != n:
    result.append(div)
result.append(i)
if len(result) == 0:
    return divide_equally(n + 1)
return result[len(result) - 2:]
Split a rectangle into n equally sized rectangles