Problem 329

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
User avatar
jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Problem 329

Post by jaap »

Problem 329 (View Problem)

Does the frog croak for its starting square, or is its first croak for the square it lands on after its first jump?
(On rereading the question I'm pretty sure it does croak for the starting square. Was the wording changed or did I just fail at reading the first time?)

Also, there is a spelling error in the question: "croacks".

harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: Problem 329

Post by harryh »

Yes, there is a croak for the first square too (the wording has not been changed).
Thanks for pointing out the spelling error - now fixed.

shachark
Posts: 4
Joined: Sat Mar 12, 2011 9:17 pm

Re: Problem 329

Post by shachark »

My strategy is comparing the given pattern to the probable pattern (according to a small prime sieve), and yet, although my fraction addition and reduction works fine, there seems to be some kind of a problem, the idea is comparing the first square, and the following 14 moves, right?
Image

elr
Posts: 67
Joined: Thu Apr 09, 2009 9:47 am

Re: Problem 329

Post by elr »

you should remember that there are many different ways to reach the "probable pattern" ...
Last edited by elr on Thu Mar 24, 2011 8:49 pm, edited 1 time in total.
Image

shachark
Posts: 4
Joined: Sat Mar 12, 2011 9:17 pm

Re: Problem 329

Post by shachark »

Well, My algorithm calculates all the possible "walks", (The first move is 0 since first spot counts, and then +/-1), then I apply them on all starting positions (dropping those who exceed limitations of course), meanwhile, I determine probabilities by comparing the right pattern, to the wanted pattern. Did I understand correctly?
Image

elr
Posts: 67
Joined: Thu Apr 09, 2009 9:47 am

Re: Problem 329

Post by elr »

seems so :) just make sure that you calculate the probability exactly as the question describe
Image

browni3141
Posts: 18
Joined: Thu Jan 20, 2011 2:06 am

Re: Problem 329

Post by browni3141 »

I think I'm close. My random generator is slightly off from my proper solution though. Are these correct:
Probability of "P" == 119/300
"PP" == 230/1497
"PNPN" == 21271/322704
Image

elr
Posts: 67
Joined: Thu Apr 09, 2009 9:47 am

Re: Problem 329

Post by elr »

P is correct PP is not.
Image

shachark
Posts: 4
Joined: Sat Mar 12, 2011 9:17 pm

Re: Problem 329

Post by shachark »

Well, I think I've found what the problem was, as my function was not a probability function (by definition, the sum wasn't 1), the only problem now is that the result is huge (really huge).

is the answer for "PPPP": 169783/6804000?
Image

LarryBlake
Posts: 100
Joined: Sat Aug 29, 2009 8:49 pm

Re: Problem 329

Post by LarryBlake »

No, sorry.
Image

User avatar
GenePeer
Posts: 112
Joined: Sat Apr 03, 2010 1:14 pm
Contact:

Re: Problem 329

Post by GenePeer »

How many characters-long is the answer for "PPPPNNPP", including the (/)?
Image

sivakd
Posts: 217
Joined: Fri Jul 17, 2009 9:37 am
Location: California, USA
Contact:

Re: Problem 329

Post by sivakd »

16
Image
puzzle is a euphemism for lack of clarity

User avatar
GenePeer
Posts: 112
Joined: Sat Apr 03, 2010 1:14 pm
Contact:

Re: Problem 329

Post by GenePeer »

Thanks! Now back #152...
Image

ukimiku
Posts: 13
Joined: Sun Jul 04, 2010 12:38 am

Re: Problem 329

Post by ukimiku »

Could someone please confirm that the probability for "PP" is 173/1125? I got "P" right, but my resulting fraction, though reduced, is awfully long...

Thank you.

Regards,
There are two kinds of people: those who divide eyerything up into two kinds, and those who don't.
http://otac0n.com/ProjectEuler/Flair/ukimiku.png

elr
Posts: 67
Joined: Thu Apr 09, 2009 9:47 am

Re: Problem 329

Post by elr »

that's a correct value !
Image

jochenkeutel
Posts: 6
Joined: Thu Oct 13, 2011 2:01 am

Re: Problem 329

Post by jochenkeutel »

Can someone confirm that PPPP is 5537/324000 ?

jochenkeutel
Posts: 6
Joined: Thu Oct 13, 2011 2:01 am

Re: Problem 329

Post by jochenkeutel »

Please forget my last post: The number mentioned there is wrong.
I've found the correct solution now, also for the full string.

m4rius
Posts: 1
Joined: Fri May 08, 2020 10:00 pm

Re: Problem 329

Post by m4rius »

Hello,
is it right to assume that the events "nth croak equals Xn", where Xn in {P, N}, are stochastically independent?
Because that's what I did and my solution seems to be wrong.
My idea was to first calculate Pn = P("frogs sits on a prime after n jumps"), P0 = 19/100 = 95/500, P1 = 24/125, P2 = 571/3000, ...
And then for n = 0..14 calculate
Qn = Pn x P("sits on a prime and croaks Xn") + (1 - Pn) x P("does not sit on a prime and croaks Xn") where X = PPPPNNPPPNPPNPN.
That is Qn should exactly be P("nth croak equals Xn") and the product of the Qn should be the solution. But it's not, so where am I wrong? :-(
Best

User avatar
sjhillier
Administrator
Posts: 546
Joined: Sun Aug 17, 2014 4:59 pm
Location: Birmingham, UK
Contact:

Re: Problem 329

Post by sjhillier »

m4rius wrote:
Fri May 08, 2020 10:22 pm
is it right to assume that the events "nth croak equals Xn", where Xn in {P, N}, are stochastically independent?
I'm not sure I entirely understand the question, but I think the answer is "No".

Let's put it this way. If the frog started near the small numbers (around 5 say), the density of primes there is quite large, and so the probability of any sequence is different to the probability if it had started near (say) 250, where there are few primes. Taking an average prime distribution over the whole range is not going to capture the slightly different probabilites which arise from the actual local distribution where the frog (randomly) started.

Post Reply