Problem 323

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.
Post Reply
Eriks
Posts: 2
Joined: Sat Feb 26, 2011 10:21 pm

Problem 323

Post by Eriks »

Hi,

I don't understand what I should look for in problem 323.

The question is : find $N$ such that all the bits are set to 1 for $i \geq N$.

What I don't understand is :
1. You can NEVER ensure that all the bits are set to 1 since the input is random. Instead, you can get a probability of having this property. In that case, the question would be "what is the min $N$ so that the probability of having all bits set to one is greater than $\lambda$".
2. Since we are looking for an integer index $N$, why do I need digits after the decimal points ?

Am I wrong ? Thanks for helping !
Hippunky
Posts: 6
Joined: Sat Feb 26, 2011 10:36 pm

Re: Problem 323

Post by Hippunky »

You're after the expected value of N - see http://en.wikipedia.org/wiki/Expected_value. The expected value won't be an integer value - which is why you'll need to include figures after the decimal point.
Eriks
Posts: 2
Joined: Sat Feb 26, 2011 10:21 pm

Re: Problem 323

Post by Eriks »

OK !
English is not my first language and I understood "expected" literally. Thanks for the answer !
TexasRebel
Posts: 7
Joined: Sun Aug 02, 2015 8:14 pm

Re: Problem 323

Post by TexasRebel »

If the sequence $y_i$ is truly random isn't there a chance, albeit very slim, that any single bit remains 0 for $N=\infty$?

reaching $x_i = 2^{32}-1$ is not an eventuality unless each 32-bit integer can only be used once.
User avatar
RobertStanforth
Administrator
Posts: 2666
Joined: Mon Dec 30, 2013 11:25 pm

Re: Problem 323

Post by RobertStanforth »

Yes, but that happens with probability 0, so that case will not affect the expected value of $N$.
TexasRebel wrote: Wed Nov 29, 2017 6:25 pm If the sequence $y_i$ is truly random isn't there a chance, albeit very slim, that any single bit remains 0 for $N=\infty$?

reaching $x_i = 2^{32}-1$ is not an eventuality unless each 32-bit integer can only be used once.
karabonev
Posts: 5
Joined: Wed May 01, 2019 3:07 pm

Re: Problem 323

Post by karabonev »

I'm having trouble understanding this problem.

I got the probabilities of a specific outcome calculated but I don't get the concept of "expected value of N".

Can someone provide an example using 3-bit integers?

EDIT:
If my understanding is correct, the expected value of N for 3-bit integers is 2.6678571429
User avatar
neverforget
Posts: 88
Joined: Sat Sep 16, 2006 10:10 pm

Re: Problem 323

Post by neverforget »

For this problem, you'll want the definition for expected value of Random variables with countably many outcomes on the Wikipedia page.

An example is not given probably because the question is already clear enough without one, and also because it may give away too much? That said, your answer for 3 bits can be readily contradicted by a naive Monte Carlo simulation.
Image
karabonev
Posts: 5
Joined: Wed May 01, 2019 3:07 pm

Re: Problem 323

Post by karabonev »

I don't see how giving an example for another sequence would give away too much.

Anyway, I wasn't aware of the Monte Carlo method. Using it lead to finding a mistake in my calculations and eventually the right answer.

Thank you, neverforget.
User avatar
SAG145
Posts: 41
Joined: Thu Apr 11, 2024 10:25 pm

Re: Problem 323

Post by SAG145 »

Can someone please tell me what the first three digits after the point of the solution are?
Also if someone can look at my code (Python) that would be wonderful.

Thanks.
Image
User avatar
neverforget
Posts: 88
Joined: Sat Sep 16, 2006 10:10 pm

Re: Problem 323

Post by neverforget »

SAG145 wrote: Mon May 06, 2024 4:11 am Can someone please tell me what the first three digits after the point of the solution are?
Also if someone can look at my code (Python) that would be wonderful.

Thanks.
If you just want 3 sig figs, you should just ask Monte Carlo as he can easily help you with that.
Image
Post Reply