def fibonacci_formula(n):
    """
    利用公式推导，纯数学计算
    f_{2m + 1} = f_{m} ** 2 + f_{m+1} ** 2
    f_{2m} = (f_{m-1} + f_{m+1}) * f_{m} = (2 * f_{m + 1} - f_{m}) * f_{m}
    奇数情况 n == 2m + 1:
        (f_{n}, f_{n+1})
         = (f_{2m+1}, f_{2m+2})
         = (f_{m} ** 2 + f_{m+1} ** 2, (f_{m} + f_{m+2}) * f_{m+1})
         = (f_{m} ** 2 + f_{m+1} ** 2, (2 * f_{m} + f_{m+1}) * f_{m+1})
    偶数情况 n == 2m:
        (f_{n}, f_{n+1})
         = (f_{2m}, f_{2m+1})
         = ((2 * f_{m+1} - f_{m}) * f_{m}, f_{m} ** 2 + f_{m+1} ** 2)
    比如，n = 1, m = 0:
        fibonacci_formula(1)
         = (f_{0} ** 2 + f_{1} ** 2, (2 * f_{0} + f_{1}) * f_{1})
         = (0 + 1, (0 + 1) * 1)
         = (1, 1)
    比如，n = 2, m = 1:
        fibonacci_formula(2)
         = ((2 * f_{2} - f_{1}) * f_{1}， f_{1} ** 2 + f_{2} ** 2)
         = ((2 * 1 - 1）* 1, 1 + 1)
         = (1, 2)
    :param n: n>0
    :return (f_{n}, f_{n+1})
    """
    if n <= 0:
        return (0, 1)
    # m = n / 2, fibonacci_formula(m) get (f_{m}, f_{m+1})
    f_m, f_m1 = fibonacci_formula(n / 2)
    if n % 2:
        return f_m ** 2 + f_m1 ** 2, (2 * f_m + f_m1) * f_m1
    return (2 * f_m1 - f_m) * f_m, f_m ** 2 + f_m1 ** 2