''' let x = y + d, z = y - d then x**2 - y**2 - z**2 = n can be written b**2 - 4bd + n = 0 so b = 2d +- sqrt(4 * d**2 - n) let t**2 = 4 * d**2 - n, then (2d + t) * (2d - t) = n ''' def dual_factor(num):