6. Given the sequence $\left\{a_{n}\right\}$ satisfies $a_{n}=(\sqrt{2}+1)^{n}-(\sqrt{2}-1)^{n}(n \in \mathbf{N})$, and $[x]$ represents the greatest integer not exceeding the real number $x$, then the unit digit of $\left[a_{2017}\right]$ is
A. 2
B. 4
C. 6
D. 8
Let $b_{n}=(1+\sqrt{2})^{n}+(1-\sqrt{2})^{n} \Rightarrow b_{1}=2, b_{2}=6$, and $x=1+\sqrt{2} \Rightarrow(x-1)^{2}=2$ $\Rightarrow x^{2}-2 x-1=0$, thus $b_{n+2}=2 b_{n+1}+b_{n}$. The pattern of the last digits is $2,6,4,4,2,8,8,4,6,6,8,2$, $2,6, \cdots$, with a period of 12, hence the last digit of $b_{2017}$ is 2, so the answer is $A$.