# Predicting a linear congruential generator (modular arithmetic)

I'm not an individual who majors in Mathematics nor am I intelligent. I'm just an average individual (average IQ) who likes to learn new things.

Was playing monopoly and realized that the number shown after the dice was thrown COULD be 'pre-programmed' instead of random. Thus, came across the linear congruential generator on Wikipedia:

As well, been reading other forums too http://www.freemathhelp.com/forum/threads/89921-Predicting-a-linear-congruential-generator-(modular-arithmetic) that an individual asked which he/she learnt that if you know the first few generated pseudorandom numbers it is possible to predict the next number without knowing any of the constants and without knowing X(0).

Last but not least, came across math.stackexchange that helps out...although I don't fully understand...Generating sequences using the linear congruential generator

That being said, given the monopoly example, since we know that the result will always be either 1 to 12, am I correct to say that 'm' = 12?

Secondly, given the example that susmits asked, where he said that if he were to chose the modulus as 8, the multiplier as 1, and the increment as 5, he obtain the sequence 5, 2, 7, 4, 1, 6, 3, 0 but why would the answer which I quote "Therefore N∣8 and an inspection of the sequence shows that a proper divisor of 8 is out of the question" where the example already shows that the modular (or divisor) is 8.

Also, how does -16 gets calculated?

|1 5 2|

|1 2 7| = -16

|1 7 4|

Last but not least, going back to the 2nd link where the individual ask "predict the next number without knowing any of the constants and without knowing X(0).", but in my case would be, we do know ONE OF THE CONSTANTS, and that would be m (I assume in this case is 12 using the monopoly dice), is there a way to determine what would be the next number rolled.

Oh, I forgot to ask too, does constant 'a' and 'c' always be a static once it's decided or can it be changed too?

In a sense, if the 1st time, X(0), a=1, c=2, that means that for X(n+1), the constants will always be 1 and 2 for a and c respectively, or can they changed in a sense X(n+1), a=5 and c=10

Thanks!

• Hint for the easiest case: If you have access to the full sequence $\{X_n\}\;$of a LCG $X_{n+1}=aX_n+c \bmod m,$ you first compute $a$ from $X_{n+1}-X_n=a(X_n-X_{n-1})\bmod m,$ by multiplying with $(X_n-X_{n-1})^{-1}\bmod m$ and then get $c=X_{n+1}-aX_n \bmod m$. – gammatester Aug 30 '16 at 14:14
• The above question that I had, I don't think it's easy for me, probably my question in asking if m=12 in case of the monopoly game. As well, I won't have access or know the full sequence. But only the a few/some...for example, you know what are the sequence from the result of the thrown dice either by you and/or the computers. – David.L Aug 30 '16 at 14:34