Let be a positive integer. A frog starts on the number line at . Suppose it makes a finite sequence of hops, subject to two conditions:
* The frog visits only points in , each at most once.
* The length of each hop is in . (The hops may be either direction, left or right.)
Let be the sum of the (positive) lengths of all hops in the sequence. What is the maximum possible value of ?
Solution
We claim the answer is .
We first prove the bound. First notice that the hop sizes are in , since the frog must stay within bounds the whole time. Let be the number of hops of size the frog makes, for .
Claim. For any we have
Proof. Let and look modulo . Call a jump small if its length is at most , and large if it is at least ; the former changes the residue class of the frog modulo while the latter does not.
Within each fixed residue modulo , the frog can make at most large jumps. So the total number of large jumps is at most .
(As an example, when this means there are at most four hops of length , at most six hops of length or , and at most seven hops total. Of course, if we want to max the length of the hops, we see that we want , , , and in general equality is achieved when for any .)
Now, the total distance the frog travels is
We rewrite using the so-called “summation by parts”:
It remains to show that equality can hold. There are many such constructions but most are inductive. Here is one approach. We will construct two family of paths such that there are hops of size , for every , and we visit each of once, starting on and ending on , for the two values .
The base case is clear. To take a path from to :
* Take a path on starting from and ending on (by inductive hypothesis).
* Take a path on starting from and ending on (by inductive hypothesis).
* Link them together by adding a single jump .
The other case is similar, but we route instead. (This can also be visualized as hopping along a hypercube of binary strings; each inductive step takes two copies of the hypercube and links them together by a single edge.)