You currently have javascript disabled. Several functions may not work. Please re-enable javascript to access full functionality.

Welcome to BrainDen.com - Brain Teasers Forum

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account.
As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends.

The army of ants

Think about the problem backwards. Define the target y-coordinate as 1 and have the army of ants start at a y-coordinate of N and occupy all spaces from N upward, and they'll move downward to reach a y-coordinate of 1.

After the final step of a solution, you would have an ant at y-coordinate 1.

Just before the final step of a solution, you need an ant at y-coordinate 2 who will be jumped by an ant at y-coordinate 3.

Just before that, you either need (if an ant will make a jump to reach y-coordinate 2 for the next step) two ants at y-coordinate 3 and one ant at y-coordinate 4 who will jump to y-coordinate 2, or (if an ant will make a jump to reach y-coordinate 3 for the next step) one ant already at y-coordinate 2 and one ant at y-coordinate 4 and one at y-coordinate 5.

Using that logic I will start re-writing those as ordered lists to make things more compact. After the final step, you have [1, 0, 0, 0...]. Just before that, you have [0, 1, 1, 0, 0...]. Just before that, you have either [0, 0, 2, 1, 0, ...] or [0, 1, 0, 1, 1, 0, ...]. It should be clear that, to get an ant to coordinate N, you must use two ants at coordinates N+1 and N+2 in the preceding move.

The problem could be rephrased as: could you do a bunch of moves (backwards like this) to reach a state [0, 0, 0, ... 0, Z, Z+1, Z+2, ...] that starts with Z zeros? The number of available ants starting at index number Z is equal to Z because you can think of this as a puzzle where, if the final square that an ant occupies after running through a solution is e.g. black if we color the grid like a chessboard, then only the ants on black squares within a 90 degree cone of the final square could contribute to the solution, and the number of such black squares increases by 1 for every row out you go.

Suppose you start at [1, 0, 0, 0, ...] and try to clear out as many rows with zeros as possible. You could go [0, 1, 1, 0, 0, ...], followed by [0, 0, 2, 1, 0, 0, ...]. Then to get those two ants at the third index you would have come from [0, 0, 0, 3, 2, 0, 0, ...]. Then it would be [0, 0, 0, 0, 5, 3, 0, ...]. So far so good, if you had the army of ants starting at row #5 then you do have five ants in that row followed by 3 ants in row 6.

But if you push things out another step, you get [0, 0, 0, 0, 0, 8, 5, 0, ...]. Now you need to take 8 ants from row #6 but you only have six ants that start out there. It could still be solvable if you have one of those ants starting at row #6 be used, either getting jumped or doing some jumping, and then have it replaced by an ant from farther down. If you had two such ants, you could get there from [0, 0, 0, 0, 0, 6, 7, 2, 0, ...].

An infinite army of ants comprises soldiers with integer coordinates on the lower half-plane including the x-axis (non-positive values of y.) The army advances upward by jumping over adjacent comrades to unoccupied positions. The y-value of the jumping ant thus increases by 2. The comrade, however, is killed in the process and removed from battle. The effect is like moves in checkers, where the jumped checker is removed, except that the ants may advance vertically as well as diagonally forward. Horizontal jumps are also permitted, but no ant may retreat. To win the war, an ant must reach an enemy stronghold somewhere in the upper half plane. Can the ants advance to arbitrarily large values of y?

I saw this puzzle in the same Peter Winkler book I mentioned elsewhere.

Spoiler for Here's what I think

His "solution" was unsatisfying, relying on some metric which scores ants above the X-axis, and higher for ants higher above the axis, and closer to the Y-axis. Since it's the infinite half-plane, it should make no difference what the X coordinate is.

I'd suggest yes, it's possible to do any arbitrary height, though I have no solid proof.

But if as in your example, we can get any ant above the X-axis, then it is fairly trivial to fill in below it, and allow a jump to a higher Y value. Sure, the devil is in the details for replacing all the jumped ants, which must come from farther and farther away. So this may end up being extremely tedious in the vein of Towers of Hanoi. Or I may be completely wrong, and it's not possible, due to backfilling all of the missing ants at an exponential rate which is faster than the growth in height above the X-axis.

the x-dependence was introduced so that the objective function would be a convergent series. The point is the effect of a jump. In configuration space you advance two levels at the cost of two holes. Can the void of two empty slots be filled efficiently enough to allow arbitrarily many jumps to greater y-values? It's not immediately clear, But an objective function would say. And it seems to say no.

It's unsatisfying in that it does't show the configurational detail. But it is elegant in that it answers the question without having to analyze the detail. Or, the effect of a jump on the objective function answers the question without having to analyze the effect of a jump on the configuration. A proof that a math person appreciates much more than an engineer (e.g. myself) does.

I hoped that posing the question here would produce some analysis at the configuration level. Let's see if it does.

Think about the problem backwards. Define the target y-coordinate as 1 and have the army of ants start at a y-coordinate of N and occupy all spaces from N upward, and they'll move downward to reach a y-coordinate of 1.

After the final step of a solution, you would have an ant at y-coordinate 1.

Just before the final step of a solution, you need an ant at y-coordinate 2 who will be jumped by an ant at y-coordinate 3.

Just before that, you either need (if an ant will make a jump to reach y-coordinate 2 for the next step) two ants at y-coordinate 3 and one ant at y-coordinate 4 who will jump to y-coordinate 2, or (if an ant will make a jump to reach y-coordinate 3 for the next step) one ant already at y-coordinate 2 and one ant at y-coordinate 4 and one at y-coordinate 5.

Using that logic I will start re-writing those as ordered lists to make things more compact. After the final step, you have [1, 0, 0, 0...]. Just before that, you have [0, 1, 1, 0, 0...]. Just before that, you have either [0, 0, 2, 1, 0, ...] or [0, 1, 0, 1, 1, 0, ...]. It should be clear that, to get an ant to coordinate N, you must use two ants at coordinates N+1 and N+2 in the preceding move.

The problem could be rephrased as: could you do a bunch of moves (backwards like this) to reach a state [0, 0, 0, ... 0, Z, Z+1, Z+2, ...] that starts with Z zeros? The number of available ants starting at index number Z is equal to Z because you can think of this as a puzzle where, if the final square that an ant occupies after running through a solution is e.g. black if we color the grid like a chessboard, then only the ants on black squares within a 90 degree cone of the final square could contribute to the solution, and the number of such black squares increases by 1 for every row out you go.

Suppose you start at [1, 0, 0, 0, ...] and try to clear out as many rows with zeros as possible. You could go [0, 1, 1, 0, 0, ...], followed by [0, 0, 2, 1, 0, 0, ...]. Then to get those two ants at the third index you would have come from [0, 0, 0, 3, 2, 0, 0, ...]. Then it would be [0, 0, 0, 0, 5, 3, 0, ...]. So far so good, if you had the army of ants starting at row #5 then you do have five ants in that row followed by 3 ants in row 6.

But if you push things out another step, you get [0, 0, 0, 0, 0, 8, 5, 0, ...]. Now you need to take 8 ants from row #6 but you only have six ants that start out there. It could still be solvable if you have one of those ants starting at row #6 be used, either getting jumped or doing some jumping, and then have it replaced by an ant from farther down. If you had two such ants, you could get there from [0, 0, 0, 0, 0, 6, 7, 2, 0, ...].

Converting my numbering to the type of numbering that would be used in the OP, my answer implies that if ants start off at y=0 and no higher, then they won't be able to reach y=7. It doesn't ensure that they can somehow reach y=6, it just doesn't rule it out as impossible.

Actually, I overlooked that the OP said the ants can jump straight vertically and straight horizontally as well as diagonally. That makes my omission of ants on the opposite color square as the final goal if the grid is colored like a checkerboard (they can contribute to a solution by being jumped), and my counting of only ants that are within a 90 degree cone of the goal (ants can jump horizontally to enter such a cone and contribute to an answer) invalid.

Allowing straight vertical jumps will mean that ants that are on the opposite color square as the goal (if the grid is colored like a chessboard) can contribute to the solution, so instead of having N ants available on row N within the 90 degree cone from the goal, you'll have 2N-1 ants available.

Taking into account the possibility of horizontal jumps, you could get two extra ants into the 90 degree cone from the goal by having an ant just outside the cone get jumped horizontally by an ant that's two spaces outside the cone. Pictorially,

That will get you two extra ants into a row's cone - one from each side. You could also get another two ants into that row of the cone by having the ants just outside the border of the cone jump up two rows into the vacated spaces to get

followed by another lateral jump into the cone, but then you would give up two ants that could have entered the cone on rows N+1 and N+2, and could have jumped each other after getting into the cone on their original rows to produce the same outcome. So for all practical accounting purposes, we can say that allowing lateral jumps will put two extra ants into each row.

So the number of ants available on each row goes from N (originally) to 2N-1 (taking into account vertical jumps) to 2N+1 (taking into account horizontal jumps). But the way of calculating the number of ants needed on each row remains the same.

Allowing straight vertical jumps will mean that ants that are on the opposite color square as the goal (if the grid is colored like a chessboard) can contribute to the solution, so instead of having N ants available on row N within the 90 degree cone from the goal, you'll have 2N-1 ants available.

Taking into account the possibility of horizontal jumps, you could get two extra ants into the 90 degree cone from the goal by having an ant just outside the cone get jumped horizontally by an ant that's two spaces outside the cone. Pictorially,

That will get you two extra ants into a row's cone - one from each side. You could also get another two ants into that row of the cone by having the ants just outside the border of the cone jump up two rows into the vacated spaces to get

followed by another lateral jump into the cone, but then you would give up two ants that could have entered the cone on rows N+1 and N+2, and could have jumped each other after getting into the cone on their original rows to produce the same outcome. So for all practical accounting purposes, we can say that allowing lateral jumps will put two extra ants into each row.

So the number of ants available on each row goes from N (originally) to 2N-1 (taking into account vertical jumps) to 2N+1 (taking into account horizontal jumps). But the way of calculating the number of ants needed on each row remains the same.