Problem 325

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
Posts: 2
Joined: Wed Feb 23, 2011 7:23 pm

Problem 325

Post by saurabhkr.1989 »


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

Re: Problem 325

Post by harryh »

Obviously, it's a winning configuration for the first player.
(S)he can win by taking 2*3 = 6 stones from the larger pile. That will leave 3,4 for the other player, which, as stated in the Problem 325 (View Problem) is a losing configuration for the player whose turn is to play.

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

Re: Problem 325

Post by sivakd »

None of the solutions in the private forum made any special use of 7^10 which is used for modulo, so I am wondering how these modulos are decided. If there is no real benefit (I am not aware of any), then why not keep it to 10^n so that it makes it a little easy to debug? I tried to port my code to C++ and gave up because of overflows.

If answering this reveals any insights to this problem, please PM me. I don't want to waste a few posts in private forum to get this clarified.
puzzle is a euphemism for lack of clarity

User avatar
Posts: 10889
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 325

Post by hk »

There's nothing special to the modulus.
Initially we had chosen 7^11=1977326743 as modulus, but thought it might be a little bit too high.
So we've chosen 7^10=282475249.
Note that 10^8<7^10<10^9.
So if we'd chosen 10^9 as modulus I'm afraid your problems would have been the same.

Posts: 2
Joined: Wed Feb 23, 2011 7:23 pm

Re: Problem 325

Post by saurabhkr.1989 »

why the player cannot take 1*3=3 stones or 3*3=9 stones leaving the configuration as 3,7 and 3,1.

User avatar
Posts: 1204
Joined: Thu Sep 16, 2010 4:39 am
Location: Manila, Philippines

Re: Problem 325

Post by kevinsogo »

The player can, but s/he would lose if s/he did.

If the configuration is (3,7): the second player will remove 1*3 leaving the configuration as (3,4) which is a losing position (as said above).

Also the configuration (3,1)=(1,3) is losing because the second player can simply remove all 1*3 coins.

The best strategy is to remove 2*3 = 6, leaving (3,4).

Posts: 1
Joined: Thu Jan 28, 2010 5:19 pm

Problem 325: no larger pile

Post by joqus »

an academic question: the configuration (1,1) is reachable from (1,2). in configuration (1,1) there is no larger pile anymore :shock: . is this a draw or a winning configuration? same for configuration (n,n), reachable from (n,k*n), n,k element N.

Posts: 382
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 325

Post by TripleM »

You're right; the problem statement doesn't actually define what happens there, but the (reasonably) obvious applies - you can treat either pile as the 'larger' pile, and thus remove all the stones and win.

Post Reply