Why is this the nearest integer?

By induction on $k$, we have $$ (N\pm \sqrt{N^2-1})^k=a\pm b\sqrt{N^2-1}$$ with $a,b\in\Bbb Z$. And of course $(N-\frac12)^2=N^2-N+\frac14<N^2-1 $ implies $$ 2N-\frac12<N+\sqrt{N^2-1}<2N.$$ Now from $$ (N+\sqrt{N^2-1})^k(N-\sqrt{N^2-1})^k=((N+\sqrt{N^2-1})(N-\sqrt{N^2-1}))^k=1^k=1,$$ we conclude that $(N+\sqrt{N^2-1})^k=a+b\sqrt{N^2-1}$ differs from the integer $2a$ by $$a-b\sqrt{N^2-1}=\frac1{(N+\sqrt{N^2-1})^k}<\frac1{(2N-\frac12)^k}.$$


Given that $\,N>1\,$ is an integer, define the real numbers $\, u := (N+\sqrt{N^2-1}),\,$ $\, v := (N-\sqrt{N^2-1}),\,$ and thus $\,u+v=2N, u\,v=1.\,$ Define the sequence $\, a(n) := u^n+v^n.\,$ This sequence satisfies $\,a(n) = a(-n)\,$ and a linear recurrence $\, a(n+1) = 2Na(n)-a(n-1) \,$ both for all integer $\,n\,$ with $\,a(0) = 2\,$ and $\,a(1) =2N.\,$ Thus all $\,a(n)\,$ are positive even integers. Read the Wikipedia article Lucas sequence for many details about such sequences.

Now notice that $\,0<v<\frac12\,$ and so $\,0<v^n<\frac12\,$ for all positive integer $\,n.\,$ Thus $\,a(n)\,$ is the closest integer to $\,u^n\,$ and $\,u^n=a(n)-v^n .\,$