Here are a couple of approaches which speed the solution dramatically for large indices.
The following code answers the question with a straight-forward While loop (@BobHanlon) giving the solution $n=127380$. Running this on a fresh kernel requires 31 s on my machine.
Block[{n = 1},
AbsoluteTiming[ While[Mod[Fibonacci[n, 2], 8417525] != 0, n++]; n]
]
{31.7111, 127380}
FibPoly2Mod[n,m] finds Mod[Fibonacci[n,2],m], by using the recursion matrix $\{\{0,1\},\{1,2\}\}$ and code similar to FibonacciMod in this question.
FibPoly2Mod[n_, m_] :=
Block[{b = {{0, 1}, {1, 2}}, d = IntegerDigits[n, 2]},
Do[
b = If[d[[i]] == 0, Mod[b . b, m],
Mod[b . b . {{0, 1}, {1, 2}}, m]],
{i, 2, Length[d]}];
b[[1, 2]]
]
For large indices, FibPoly2Mod[n,m] is much faster than Mod[Fibonacci[n,2],m].
For Fibonacci numbers, the Pisano period $k[m]$ of Mod[Fibonacci[n],m] is the LCM of the periods of the prime powers in the modulus $m$. That is, $k[m]={\rm LCM}[k[p_ 1^{e_ 1}],k[p_ 2^{e_ 2}],...,k[p_j^{e_j}]]$, where $m=p_ 1^{e_ 1}p_ 2^{e_ 2}...p_j^{e_j}$.
Therefore, I conjecture that the period of Mod[Fibonacci[n,x],m] equals the least common multiple of the periods of the prime powers making up the modulus $m$.
FibPoly2Mod0[m_Integer] :=
Block[{p, f, n},
p = FactorInteger[m];
f = Table[
n = 1;
While[FibPoly2Mod[n, p[[i, 1]]^p[[i, 2]]] != 0, n++];
n,
{i, 1, Length[p]}];
LCM @@ f
]
The code takes only 0.03 s, compared with 31 s for the While loop.
RepeatedTiming[FibPoly2Mod0[8417525], 10]
{0.0294806, 127380}
My tests so far suggest the conjecture is true...
Fibonacci[n,x]provides the polynomials. Please show your code ( "Table[Fibonacci[x,2]mod(8417525)=0,{x,a,b}]" doesn't evaluate ) . – Ulrich Neumann Feb 21 '22 at 11:50