Given the following function $f$
$f(1)=1$
$f(n)=11\cdot f(n-1)+2^{n-1}$
I would like to compute $f(13^{17})\mod 10^9$ and ended up using the following :
$f(n)=\sum_{i=0}^{n-1}({11^{n-(i+1)}\cdot 2^i})$
though I am able to quickly compute a single term using modular exponentiation, the loop over $13^{17}-1$ takes ages.
So do you have any suggestion to simplify $f(n)$ to avoid the loop ?
Note that $f(n)$ may be simply rewritten as $\displaystyle f(n)=\frac{11^n-2^n}{11-2}$