How to check if $x_{100}$ is prime or not? I have $$x_{n}=5x_{n-1}-4x_{n-2}+6$$ and I have found that the $n$-th term is$$x_{n}=-{1\over3}+{7\over12}\cdot4^n-2n$$ I must demonstrate if $x_{100}$ is a prime number or not. How should I begin? I must find if $x_{100}$ is divisible by $3$ or not.

$$x_n=-{1\over3}+{7\over3}4^{n-1}-2n$$

$x_n$ is an integer for all $n\ge1$.

Proof:
$$7\cdot4^{n-1}\equiv1\cdot1^{n-1}=1\mod 3$$
So fractional part of $x_n=-{1\over3}+{1\over3}=0$.

$x_{100}$ is  divisible by $3$.

Proof:
$$7\cdot4^{100-1}\equiv7\cdot64^{33}\equiv7\cdot1^{33}=7\mod 9\\
200\equiv2\mod 3$$
So fractional part of ${x_{100}\over3}=-{1\over9}+{7\over9}-{2\over3}=0$.
$$$$
