I came across this recurrence function:
$F(n) = a \times F(n-1) + b$
where $F(0) =1$. We have to solve for $F(n) \pmod {m}$
But for very large $n$, solving it with computer is also taking time. Is there anyway to simplify this. I think the values will be repeated again after some '$n$' based upon the values of $a,b$ and $m$. But I am unable to figure out how to solve it.