How do I show that $\lfloor{(\sqrt 2+1)^{2020}}\rfloor\equiv 1\left(\text{mod}~ 4\right)$? I think I can use that $$(a\sqrt b+c)^{2n}+(a\sqrt b-c)^{2n}\in\mathbb{Z},$$ but I have no idea about the next step.
 A: Hint: $(\sqrt{2}+1)^n + (-\sqrt{2}+1)^n$ satisfies a recurrence.
A: Expanding
Robert Israel's suggestion
(always a good thing to do):
If
$a_n
=u^n+v^n
$
then
$\begin{array}\\
a_n(u+v)
&=u^{n+1}+v^{n+1}+uv^n+vu^n\\
&=u^{n+1}+v^{n+1}+uv(v^{n-1}+u^{n-1})\\
&=a_{n+1}+uva_{n-1}\\
\end{array}
$
so
$a_{n+1}
=a_1a_n-uva_{n-1}
$.
If
$u = 1+\sqrt{2}$
and
$v = 1-\sqrt{2}
$
(trying
$u = \sqrt{2}+1,
v = \sqrt{2}-1$
doesn't work)
then
$uv = -1$
and
$u+v = 2$
so
$\begin{array}\\
a_{n+1}
&=2a_{n}+a_{n-1}\\
&=2(2a_{n-1}+a_{n-2})+a_{n-1}\\
&=5a_{n-1}+2a_{n-2}\\
&=5(2a_{n-2}+a_{n-3})+2a_{n-2}\\
&=12a_{n-2}+5a_{n-3}\\
\end{array}
$
so,
mod 4,
$a_{n+1}
=a_{n-3}
=a_{n+1-4k}
$
for $k \ge 0$.
Since
$a_0 = 2,
a_1 = 2,
a_2 = 6,
a_3 = 14
$,
we have
$\begin{array}\\
a_{2020}
&=a_{2020-4\cdot 505} \bmod 4\\
&=a_0 \bmod 4\\
&=2\\
\text{and}\\
u^{2020}
&=a_{2020}-v^{2020}\\
\text{so}\\
\lfloor u^{2020}\rfloor
&=\lfloor a_{2020}-v^{2020}\rfloor\\
&=a_{2020}-1
\qquad\text{since } 0 < v^{2020} < 1\\
&= 2-1  \bmod 4\\
&= 1 \bmod 4\\
\end{array}
$
A: Let $r,s$ be given by
\begin{align*}
r&=1+\sqrt{2}\\[4pt]
s&=1-\sqrt{2}\\[4pt]
\end{align*}
Noting that $r,s$ are the roots of the equation
$$x^2-2x-1=0$$
it follows that for all integers $n$, we have
\begin{align*}
&r^n-2r^{n-1}-r^{n-2}=r^{n-2}(r^2-2r-1)=0\\[4pt]
&s^n-2s^{n-1}-s^{n-2}=s^{n-2}(s^2-2s-1)=0\\[4pt]
\end{align*}
hence by summing the above and letting $t_n=r^n+s^n$, we get
$$t_n-2t_{n-1}-t_{n-2}=0$$
for all integers $n$.

Noting that $t_0=2$ and $t_1=2$, an easy induction shows that

*

*$t_n$ is an integer$\\[4pt]$

*$t_n\equiv 2\;(\text{mod}\;4)$
for all nonnegative integers $n$.

Now suppose $n$ is an even positive integer.

Noting that $-1 <  s < 0$, it follows that $0 < s^n < 1$, hence
$$t_n-1=r^n+s^n-1=r^n+(s^n-1) <\, r^n <\, r^n + s^n=t_n$$
so
$$
\lfloor{r^n}\rfloor=t_n-1\equiv 1\;(\text{mod}\;4)
$$
