Problem 393

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
jmjoebar
Posts: 3
Joined: Mon Sep 10, 2012 8:32 am

Problem 393

Post by jmjoebar »

http://projecteuler.net/problem=393

this one is really challenging... as a brute force approach will take ages ! I strongly congratulate those who managed to solve it so rapidly.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 393

Post by hk »

@ jmjoebar:
Please restrict yourself to meaningful posts.
Messages like the above probably fit in a tweet and could be better placed on Twitter.
Image
War ruins the life and health of untold numbers of innocent children.
jmjoebar
Posts: 3
Joined: Mon Sep 10, 2012 8:32 am

Re: Problem 393

Post by jmjoebar »

Sorry for that hk.

Let's try to be more constructive. I have an aglo written in Python that gives a quick answer for f(2) (trivial case=2), and f(4) as in the descriptoin f(4)=88.
However, it's damn too slow for having a result on f(10) within a minute.
Even f(6) takes couple of minutes... [I understand I shall not post my result for f(6) as it can be considered as a partial answer !]
So I think there is a more clever approach than brute force search. Can anybody confirm ?

JM
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 393

Post by hk »

@ jmjoebar:
Yes there is. Happy now?
In case you are phishing for that approach: this forum is not meant to discuss solution methods, and moreover it is moderated.
This forum is meant to give clarifications in case the wording of a problem isn't understood. It seems to me that you perfectly well understand the wording.
So could you please stop it now?
Image
War ruins the life and health of untold numbers of innocent children.
User avatar
mctrafik
Posts: 27
Joined: Thu Oct 06, 2011 6:42 am
Location: Los Angeles, California
Contact:

Re: Problem 393

Post by mctrafik »

So f(3) = 0 because there's nowhere the center ant can move. Am I correct?
Image
"Nothing in this world that's worth having comes easy"
unime
Posts: 17
Joined: Mon Mar 24, 2008 4:11 am

Re: Problem 393

Post by unime »

mctrafik wrote:So f(3) = 0 because there's nowhere the center ant can move.
Not precisely. All ants, including the center and, must move to an adjacent square.

The question is whether they can do so while meeting the conditions (no two end up in the same square, no crossing the same edge), and if so how many times. n=3 is small enough to brute force if you need to.
mdean
Posts: 206
Joined: Tue Aug 02, 2011 2:05 am

Re: Problem 393

Post by mdean »

I think I see a way to show that f(3)=0 as well as a stronger statement, but I don't know what, if anything, it might give away.
Image
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 393

Post by thundre »

mdean wrote:I think I see a way to show that f(3)=0 as well as a stronger statement, but I don't know what, if anything, it might give away.
Having solved the problem, I will say that a proof that f(n)=0 for odd n has nothing to do with the problem of calculating it for even n.
Image
mdean
Posts: 206
Joined: Tue Aug 02, 2011 2:05 am

Re: Problem 393

Post by mdean »

All right, I'll take your word for it. If worse comes to worse, I can delete it later.

Start with any square. The ant from that square moves to an adjacent square. Another ant moves from that adjacent square to a third square. Due to the constraints of the problem, at some point this path needs to lead back to the original square to form a cycle (there are a finite number of squares and every other square in this path is already the destination square of one ant). Every time the path moves down, it must eventually move back up the same number of squares. Similarly with left and right. Therefore, the size of this cycle must be even.

So if n is odd, it is impossible for each of $n^2$ squares to be part of exactly one even cycle as each cycle contains an even number of squares so the total number of squares in such cycles is even while $n^2$ is odd. The conclusion follows that for odd n, f(n)=0.
Image
User avatar
kevinsogo
Administrator
Posts: 1204
Joined: Thu Sep 16, 2010 4:39 am
Location: Manila, Philippines

Re: Problem 393

Post by kevinsogo »

Another proof for odd n: Color the squares with black and white like a checkerboard. An ant in black goes to white, and an ant in white goes to black. Since number of black cells != number of white cells, it's impossible.
lucaswerkmeister
Posts: 3
Joined: Tue Jan 15, 2013 7:11 pm

Re: Problem 393

Post by lucaswerkmeister »

Is it allowed if I ask anyone who already solved the problem if he/she would verify my result for f(6)? I want to make sure my algorithm is right before spending hours of computation time on it (unless I find some clever shortcut).
Image
User avatar
Marcus_Andrews
Administrator
Posts: 1637
Joined: Wed Nov 09, 2011 5:23 pm

Re: Problem 393

Post by Marcus_Andrews »

Feel free to PM me and I'll let you know if your result is right or not.
Post Reply