Problem 239

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 239

Post 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.
Image
szymczak
Posts: 15
Joined: Wed Nov 23, 2011 8:43 am

Re: Problem 239

Post 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.
Image
Post Reply