Hello Roie! Thanks for the statistic help!
roiem wrote: >> I think there's a bug in your f(n) = >> 1-(n!-1)/n!^1e6: What you're saying is that >> f(n) = 1-[probability of generating only n!-1 >> permutations, 1e6 times]. But that doesn't take >> into account the choice you have to make, which >> will be the permutation that you won't generate. >> This means that your chances of success are >> actually less than what you expected. >> For example, let's say n=2, and instead of 1e6 >> we'll use four. You're going to make four random >> permutations, with n!^4=2^4=16 different possible >> results. There are however two results that don't >> match (ab ab ab ab and ba ba ba ba), so your >> probability of success is only 14/16=7/8, and not >> 15/16 as the above formula (1/(1/2)^4) would >> suggest. I think I still need a little help with this argument. Let me explain how I see it a little better, and maybe that'll show where I'm may be misunderstanding... My actual f(n) is 1-((n!-1)/n!)^1e6). I think the way you wrote it, order of precedence makes it quite different. (Don't exponents normally take precedence over division?) Regardless, it doesn't look like it changed your calculations... Again, using 4 tries instead of 1e6... My f(n) is supposed to be: 1 minus the probability that there's a permutation that I won't randomly choose. The probability that I will not choose a certain permutation is ((n!-1)/n!)^4 Now looking at your example, I agree that there are 16 different ways to order the possible output, 2 of which lack all permutations: Let ab = 0 and ba = 1 0000 0100 1000 1100 0001 0101 1001 1101 0010 0110 1010 1110 0011 0111 1011 1111 So I think the problem may be that ((n!-1)/n!)^4 is the probabilty that I will not choose any one particular item. But I need the probability that I won't choose ANY particular item! make f(n) = 1 - (n * ((n!-1)/n!)^x) so in our case f(n) = 1 - (2 * (1/2)^4), yeilding the desired 14/16. Thanks for all the help, Roiem! Does this seem like a better f(n)?? -Riley (o0lit3) Out of curosity I re-calculated f(n) for 1..8 to see how different my values might be. Again I ran into calculator problems... f(1) = 1 - (1 * (0/1)^1e6) = 1 f(2) = 1 - (2 * (1/2)^1e6) = (really close to 1) ... f(7) = 1 - (7 * (5039/5040)^1e6) = (really close to 1) f(8) = 1 - (8 * (40319/40320)^1e6) = 0.99999999986455471045756252410042 (New f(8) = 0.99999999986455471045756252410042) (Old f(8) = 0.99999999998306933880719531551255)