Given two positive integers n, and MOD, please calculate. The value of n may have many many digits!
You are given four positive integers x_0, x_1, a, b x ,x 1 ,a,b. And you know x_i = a cdot x_{i-1} + b cdot x_{i-2} x i =a⋅x i−1 +b⋅x i−2 for all i ge 2 i≥2. Given two positive integers n, and MOD, please calculate x_n x n modulo MOD. Does the problem look simple? Surprise! The value of n may have many many digits!
(图片来源网络,侵删)