I've been wondering about periods and solving for explicit relations of linear recurrences when working under a modulo. So like for example, The fibonacci sequence is defined as $F_0=0,F_1=1,F_n=F_{n-1}+F_{n-2}$. And one can find that $F_n=\frac{1}{\sqrt{5}}\left(\left(\frac{1+\sqrt{5}}{2}\right)^n-\left(\frac{1-\sqrt{5}}{2}\right)^n\right)$. However, if we were trying to find this recurrence in $\bmod 2$, this clearly wouldn't work as dividing by $2$ is most definitely not possible. If we instead tried to find the roots of the characteristic polynomial $x^2-x-1$ in$\bmod 2$, we would find that there are none, so this approach does not work as well. Moreover, from inspection the fibonacci sequence has period $3$ in $\bmod 2$, but if we were to express its explicit form as a sum of two powers we would not be able to as there are no numbers that have order $3$ in$\bmod 2$.
If instead, we tried to find an explicit formula for $F_n$ in$\bmod 3$, then we would need to find some $a$ such that $a^2\equiv 5\mod 3$. However, this clearly has no solution as $5$ is a nonquadratic residue in$\bmod 3$ (unless maybe we somehow introduce some type of imaginary number?). Also there are no elements with order $8$ in$\bmod 3$.
If we try to find a formula in$\bmod 5$, then we find that the solutions to $x^2-x-1$ has a double root of $x\equiv 3\bmod 5$, so we can determine that $F_n\equiv 4n\cdot 3^n\mod 5$. This seems to also match with the fact that $F_n$ has period $20$ in$\bmod 5$.
So, in the end we were able to find that we can explicitly find an equation for $F_n$ when taken modulo $p$ for some primes (particularly only $p=5$, but I'm sure there are others where $5$ is a quadratic residue). But I find it hard to believe that we can't find an explicit formula for other primes. Are there any other techniques to solve in these primes? Also this is only for the fibonacci sequence. What about for other recurrences, including higher order ones?
Rigorously, we adoin $i$ by working in $\Bbb Z_3[x]/(x^2+1)$ where $,i := \bar x$ is the image of $x$ in the quotient ring; equivalently we work with expressions of the form $,a+b, i,$ mod $,i^2+1,\ a,b\in\Bbb Z_3,,$ the same way we adjoin $i$ to $\Bbb R$.
– Bill Dubuque Dec 10 '21 at 10:25$$\begin{align} F_n, =\ &\dfrac{x^n-\bar x^n}{x-\bar x}\ \ {\rm in}\ \ \Bbb Z[x]/(x^2!-!x!-!1),\ \ {\rm where}\ \ \bar x = 1-x\[.2em] =\ & \dfrac{x^n-(1!-!x)^n}{2x-1}\bmod x^2!-!x!-!1 \end{align}\qquad$$
– Bill Dubuque Dec 11 '21 at 12:15