The Tribonacci sequence satisfies
$$T(n) = T(n-1) + T(n-2) + T(n-3)$$
with $T(0)=0$, $T(1)=1$, $T(2)=1$. I need to calculate $T(y) \mod 10000$ for $y > 2^{40}$.
How can I make this faster? I know that this is periodic in $(\mathbb{Z}/10000\mathbb{Z})^3$, but I can't find the period.
Any suggestions? My program needs a lot of time to calculate such $T(y)$.