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-10 15:56

>>32
will take forever to give an answer
Did you miss the part where the answer was given less than an hour after you posted your problem? And it was most likely not seen immediately.

Name: RecursiveFaggot !FROzeN.uHg 2009-01-11 1:24

>>27
Here's one equivalent to my original solution, only much cleaner:

getb a m n nn = mod (nn - n * a) m

solve = [ (a,b,m) | m <- [9585 ..  ],
                    a <- [   1 .. m],
                    b <- [getb a m 6543 6331],
                    b == getb a m 6331 9584,
                    b == getb a m 9584 9025,
                    b == getb a m 9025 3911]


It runs in ten seconds.

>>40
That's not a for loop.  He used HASKELL NOMADS.

Name: Anonymous 2009-02-25 8:19


The code but he   never died in   the first place   elegant expression of   a fundamental type   of logic The.

Name: Anonymous 2009-02-25 8:39

lol @ 'You should be able to solve this'

Name: Anonymous 2009-02-25 9:40

>>43
FrozenVoid is getting better at English!

Name: Anonymous 2009-02-25 20:30

>>45
Please never mention THE FROZEN NAME again!

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