ProjectEuler/python/135.1.py
2017-09-13 17:48:19 +08:00

9 lines
204 B
Python

'''
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):