Algorithmic puzzle · integer answermedium50 min
Second-order oscillator modulo a prime
Recursive Sequences
Define b_0=5, b_1=11, and b_n=(4*b_(n-1)-b_(n-2)) mod 1000003 for n>=2. Find b_50000.
Solve using mathematics, algorithms, or your own code offline. Submit only the final integer here—no program, expression, graph, or written proof.
Check your answer without signing in. Sign in to save your progress.
How to approach this problem
Normalize each subtraction into the nonnegative range [0,m−1]. Carry only the previous two values, or use matrix exponentiation for a distant index.
Worked example with different values
Modulo 7, −2 and 5 represent the same residue. If a recurrence step yields −2, store 5.
Apply the same reasoning to the challenge. This example is a separate practice problem.
Learn the technique: Number theory: divisors, gcd and modular arithmetic