A function satisfies: and for all integers and . What is the maximum possible value of ?
Solution
Consider a graph on with an edge between and for all integers and . Each vertex is given the value . The inequality means that any two adjacent vertices of this graph must have values which differ by at most 1. Then it follows that for all , because if we follow a path from 0 to , along each edge the value increases by at most 1. Conversely, if we define to be the number of edges in the shortest path between 0 and , then this is a valid function because for any two adjacent vertices, the lengths of their respective shortest paths to 0 differ by at most 1. Hence it suffices to compute the distance from 0 to 2019 in the graph. There exists a path with 4 edges, given by Suppose there existed a path with three edges. In each step, the number changes by a power of 2, so we have for some nonnegative integers and choice of signs. Since 2019 is odd, we must have somewhere. Then we have . Without loss of generality assume that . Then we can write this as . It is easy to check that is impossible, so the factorization is a product of a power of two and an odd number. Now compute and . Neither of the odd parts are of the form , so there is no path of three steps. We conclude that the maximum value of is 4.