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: Anonymous 2009-01-09 21:28

>>16 here. What I hope that you take away from this is that not every programmer needs to be a crazy mathematical genius who knows every algorithm and data structure known to man. A good programmer doesn't even need to be an incredible genius.

What a good programmer needs is the knowledge that they don't know everything there is to know, and that they need to be constantly searching for a better way.

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