Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

You should be able to solve this

Name: The Silent Wind of Doom 2009-01-09 15:55

A common algorithm for generating pseudorandom numbers is a "linear congruential generator" which uses the following procedure:

1) A positive integer m and two integers a and b between 0 and m−1 are fixed.

2) A seed r(0) between 0 and m−1 is input.

3) After that, numbers are generated by the recurrence r(n+1) = ar(n)+b (mod m).  (So that 0 <= r(n+1) <= m−1).


The following sequence of numbers was generated in this way.

6543
6331
9584
9025
3911

Find a,b, and m.

(crossposted from /sci/, cuz i herd u liek math).

Name: RecursiveFaggot !FROzeN.uHg 2009-01-09 19:35

>>13
Eh, it's easy with brute force.
Iterate through reasonable values for (a,m).  Try each step with b=0 and subtract from the actual next element to find what b would work there.  If all the b values are equal, that's you're answer.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List