# Robot ants that stay forever on a rod

You can place any positive number of robot ants on a long rod and set each of them to move left or right starting at time $$0$$. You can set any positive speed for each ant. When 2 or more ants meet, they turn around. When an ant reaches the end it falls off.

Can you place and set the ants in such a way that none of them ever falls off?

• I must be missing something, but it seems that the answer is trivially "no". This is because you always have the last ant near the end that cannot be saved. May 27 at 3:54
• @DmitryKamenetsky "When 2 or more ants meet, they turn around".
– Eric
May 27 at 4:24
• Yes I get that. But at some point the last ant will head towards the end. Since he is the last ant there will be nothing to make him turn around and he will fall off. May 27 at 4:26
• @DmitryKamenetsky The one to his left may catch up, so they both turn around.
– Eric
May 27 at 4:36
• @Moti Why does it have to be even?
– Eric
May 27 at 9:34

Yes, you can. One possible arrangement comes with

4 ants

Placement:

Starting positions: -3, 0, 0, 3
Starting speeds: -1, -2, 2, 1

This way they'll all stay on the rod because:

The two "outer" ants turn around at ±6 and ±2, the "inner" ants turn around at a sequence of {±6, 0, ±2, 0}, so these 4 ants never fall out of the range [-6, 6].

• Elegant solution! May 27 at 10:21
• More generally, any mirrored pattern of four ants where the outer ants are moving more slowly than the inner ants has a finite length. May 28 at 5:58
• @ArcanistLupus More generally, any mirrored pattern of an even number of ants, where the second-to-outer ants move more slowly than the outmost ants, is a solution.
– iBug
May 28 at 6:05
• @iBug That won't always work - for example, take the configuration in this answer and add two very slow ants far from the center traveling outward. May 28 at 14:21
• There are more solutions, all "symmetrical" around a center. Seems that for the specific solution, duplicating groups of two with same pattern and timely placed at the edge of the first four grouping will meet the requirement. Note that each two just to need to meet another two.
– Moti
Jun 12 at 0:10

Frame challenge answer: you can do it with an arbitrary number of ants, because

the puzzle does not specify the orientation of the rod relative to directions "left" and "right".

Therefore,

if you stand the rod on end so that "left" and "right" produce paths around its circumference then no ant traveling directly right or directly left will ever fall off.

In fact,

the rod does not even need to be perpendicular to the left / right direction. For a wide variety of rod shapes, there are inclination angles that afford leftward and rightward paths that are closed and do not leave the surface of the rod (without relying on the ends of the rod being traversed).

• It really depends what we mean by "ant" in the first place. And what does it mean to "fall", are we talking earth gravity or moon gravity? May 29 at 5:55