Re: An Applied Algorithmic Activity:
- Posted by Patrick Barnes <mrtrick at gmail.com> Jun 30, 2004
- 421 views
> One way to do this is to iterate using a number that is relatively prime > to N. If two numbers are relatively prime, it means that their greatest > common divisor is 1. > > So suppose N = 10. You could use 7, to pick a number at random, and > you would get (modulo 10, of course): > > 7, 4, 1, 8, 5, 2, 9, 6, 3, 0 That looks good! Now I just need a lowest common denominator function:
function lcd(atom a, atom b) atom c while b do c = remainder(a, b) a = b b = c end while return a end function
(Hooray for Eulers method - http://www.mathwizz.com/fractions/help/help3.htm ) and that'll give me a list of possible seed values. Thanks all... this should work. -- MrTrick