## 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

Don't post any spoilers
jaap
Posts: 550
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Problem 329

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

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

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?

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

### Re: Problem 329

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.

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

### Re: Problem 329

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?

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

### Re: Problem 329

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

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

### Re: Problem 329

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

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

### Re: Problem 329

P is correct PP is not.

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

### Re: Problem 329

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?

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

### Re: Problem 329

No, sorry.

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

### Re: Problem 329

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

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

### Re: Problem 329

16

puzzle is a euphemism for lack of clarity

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

### Re: Problem 329

Thanks! Now back #152...

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

### Re: Problem 329

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

that's a correct value !

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

### Re: Problem 329

Can someone confirm that PPPP is 5537/324000 ?

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

### Re: Problem 329

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

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

sjhillier