Problem 321

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
LarryBlake
Posts: 100
Joined: Sat Aug 29, 2009 8:49 pm

Problem 321

Post by LarryBlake »

Problem 321 (View Problem)
Can a counter jump another counter of the same color?
Image
User avatar
GenePeer
Posts: 112
Joined: Sat Apr 03, 2010 1:14 pm
Contact:

Re: Problem 321

Post by GenePeer »

Whichever the case, I doubt it would provide the optimal solution.

This is the first "new" problem I have tried, as I prefer solving sequentially. I'm currently at 103. I've found a formula for the number of moves needed, and was able to generate the first 22 terms. It could take days if I continued like this. Can someone hint me in the right direction?
Image
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: Problem 321

Post by stijn263 »

Can you perhaps spot a pattern among those first 22 terms?

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

Re: Problem 321

Post by GenePeer »

Why did I think there's no possible pattern? Thank you, I just had my first post in an unarchived thread.
Image
sivakd
Posts: 217
Joined: Fri Jul 17, 2009 9:37 am
Location: California, USA
Contact:

Re: Problem 321

Post by sivakd »

GenePeer, congratulations. I just noticed that you are the only person from your country. So, a good achievement indeed.
GenePeer wrote:Why did I think there's no possible pattern? Thank you, I just had my first post in an unarchived thread.
Image
puzzle is a euphemism for lack of clarity
john.schooling
Posts: 1
Joined: Sun Jan 09, 2011 6:37 pm

Re: Problem 321

Post by john.schooling »

I get 5=99, 10=8108, 20=54608372. Can anyone confirm this is correct please. My answer to 40 terms is incorrect. I may have a rounding or overflow problem.
Thanks.
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 321

Post by jaap »

Those numbers are correct.
gotclout
Posts: 1
Joined: Mon Mar 14, 2011 11:32 pm

Re: Problem 321

Post by gotclout »

john.schooling wrote:I get 5=99, 10=8108, 20=54608372. Can anyone confirm this is correct please. My answer to 40 terms is incorrect. I may have a rounding or overflow problem.
Thanks.
I'm having a similar issue, however I'm making a first attempt to solve this in python and I'm not sure if the problem could be rounding or overflow.
ingreenheaven
Posts: 4
Joined: Wed Apr 20, 2011 6:50 am

Re: Problem 321

Post by ingreenheaven »

GenePeer wrote:Why did I think there's no possible pattern? Thank you, I just had my first post in an unarchived thread.
I can't see the pattern :(
ingreenheaven
Posts: 4
Joined: Wed Apr 20, 2011 6:50 am

Re: Problem 321

Post by ingreenheaven »

My answer for 20 matches with the answers above, but my final answer is not correct. Can somebody verify if these values are correct. 25: 636562052 and 30: 1583407950?

Also any push in the right direction for identifying the pattern will be very helpful.
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 321

Post by jaap »

ingreenheaven wrote:My answer for 20 matches with the answers above, but my final answer is not correct. Can somebody verify if these values are correct. 25: 636562052 and 30: 1583407950?
No. You probably have a 32 bit integer overflow problem. You need 64 bit integers.
ingreenheaven
Posts: 4
Joined: Wed Apr 20, 2011 6:50 am

Re: Problem 321

Post by ingreenheaven »

jaap wrote:
ingreenheaven wrote:My answer for 20 matches with the answers above, but my final answer is not correct. Can somebody verify if these values are correct. 25: 636562052 and 30: 1583407950?
No. You probably have a 32 bit integer overflow problem. You need 64 bit integers.
Thank you.
ingreenheaven
Posts: 4
Joined: Wed Apr 20, 2011 6:50 am

Re: Problem 321

Post by ingreenheaven »

Done. It was a problem with precision. The pattern that I thought was there didn't work because of precision error and so I thought I was missing something. Thanks for your help.
DeEiserne
Posts: 2
Joined: Wed Dec 17, 2014 11:14 pm

Re: Problem 321

Post by DeEiserne »

There's something I don't quite understand:
If we take n=2, then we have 2 red, 2 blue counters. Let's just write the configuration as 1 2 3 4 5 , where 1 and 2 are initially occupied by the 2 red counters, etc. For n=2, there is a solution with 8 actions:

2 -> 3
4 -> 2
5 -> 4
3 -> 5
1 -> 3
2 -> 1
4 -> 2
3 -> 4

M(1) is clearly 3 and M(3) is clearly 15, so according to the problem's description, M(2) should be 10. But M(2) is 8 (see above) and 8 is clearly not a triangle number.
What am I doing wrong?
User avatar
mpiotte
Administrator
Posts: 1961
Joined: Tue May 08, 2012 5:40 pm
Location: Montréal, Canada

Re: Problem 321

Post by mpiotte »

DeEiserne wrote:There's something I don't quite understand:
If we take n=2, then we have 2 red, 2 blue counters. Let's just write the configuration as 1 2 3 4 5 , where 1 and 2 are initially occupied by the 2 red counters, etc. For n=2, there is a solution with 8 actions:

2 -> 3
4 -> 2
5 -> 4
3 -> 5
1 -> 3
2 -> 1
4 -> 2
3 -> 4

M(1) is clearly 3 and M(3) is clearly 15, so according to the problem's description, M(2) should be 10. But M(2) is 8 (see above) and 8 is clearly not a triangle number.
What am I doing wrong?
You misread the question. Nowhere is the value of M(2) provided. The problem statement gives that M(3) = 15 and that M(1), M(3), M(10), M(22) and M(63) are triangular numbers (without giving the value).
Image
DeEiserne
Posts: 2
Joined: Wed Dec 17, 2014 11:14 pm

Re: Problem 321

Post by DeEiserne »

Oh my god, I feel so stupid. Thank you for the clarification!
User avatar
Jochen_P
Posts: 55
Joined: Mon Oct 05, 2009 10:47 am
Location: Stuttgart, Germany

Re: Problem 321

Post by Jochen_P »

stijn263 wrote: Sun Jan 23, 2011 6:04 pm Can you perhaps spot a pattern among those first 22 terms?

Have fun solving!
hmm ... pattern spotting ... 1,3,10,22,63,1nn,3nn :shock:
Nope, don't see any. Any hint?

Got the same results as others for 20(correct), 25(false) and 30(false)
Image
User avatar
Jochen_P
Posts: 55
Joined: Mon Oct 05, 2009 10:47 am
Location: Stuttgart, Germany

Re: Problem 321

Post by Jochen_P »

Got it ... very nice pattern, not easy to spot
Image
Post Reply