LCG: finding parameters a and c
Now the situation is more difficult: we don't have the source code of the generator. We only know the modulus (it is usually written in the documentation or guessed from the magnitude of the values), while the multiplier a and the increment c are secret.
But the LCG is linear, so the difference between consecutive states eliminates c:
x2 - x1 = (a*x1 + c) - (a*x0 + c) = a * (x1 - x0) (mod m)
So a = (x2 - x1) * (x1 - x0)^(-1) mod m, then c = (x1 - a*x0) mod m. Since the modulus is a prime number, every non-zero difference has an inverse element.
Captured 6 consecutive internal states (modulus m = 2147483647):
x_0 = 1249239498
x_1 = 1789362674
x_2 = 663776103
x_3 = 1345825514
x_4 = 919511159
x_5 = 147564790
Find a and c and assemble the flag like this: BAYROQ{PRNG_lcg_a_<a>_c_<c>} — both numbers are in the range 0 .. m-1, written in decimal format.
It is easy to check your answer: recalculate from x_2 to x_5 with the found a and c — everything should match.