y=\frac{\left(x_0+y_0\sqrt D\right)^n-\left(x_0-y_0\sqrt D\right)^n} {2\sqrt D}