So I have this function, $f(n)$. If $n$ is odd it equals $2$, if $n$ is even it equals $1$. For example, $f(1) = 2$ and $f(2) = 1$.
I need to find a recurrence relation for this function. However, I can't figure out at all how to "properly" find one by calling $f(n-1)$. I could only find:
$$f(n) = \mod(n,2) + 1$$
Is there a way to replace the mod operator to have a proper recurrence relation that returns the same results?
EDIT: currently trying out your answers. Please post them as $$f(n) = something.
Basically I want $$f(n) when n is greater or equal to 3.
$$f(n+1)=f(n)+(-1)^n\quad\text{with }f(1)=2.$$