Page 2 of 2

Re: Problem 239

Posted: Sat Dec 17, 2011 2:09 pm
by thundre
szymczak wrote:If I make a nice write up of my solution (formula and explanation) will you, or anyone else who has solved the problem take a PM and look at it? At least to tell me where (and not how) my reasoning went wrong.
I think there are more things you can do yourself first.

If you add all your probabilities for 0 to 25 out of place, is the sum equal to 1?

Is the expected value for the number of out-of-place primes equal to the obvious? (I found it easier to count in-place primes.)

Are all your probabilities multiples of (1/n!)? This might be easier to check with a lower n than 100, say 5.

Re: Problem 239

Posted: Sat Dec 17, 2011 10:16 pm
by szymczak
AH HA! Solved it!
thundre wrote:If you add all your probabilities for 0 to 25 out of place, is the sum equal to 1?
I was getting 0.964527833501. Thanks for the suggestion. I needed some obvious way to check for errors.

One of my base cases was this: number of ways to place k discs all incorrectly in k spots.
I had coded this to be 0, which is just plain wrong.

2 1 is an obvious counter-example

Edit:
Damn I feel stupid looking at other peoples solutions. I approached the problem combinatorially. My solution is exactly like loreto's, about 2/3rds of the way down the first page.