Problem:
Let be a set of size . Find the maximum number of pairs of elements so that is a power of .
Solution
Solution:
Let be the maximum possible number of such pairs for a set of size . Let be the number of ones in 's binary representation. Let . We show that .
For the construction, we can take the binary representations of all numbers from to , and interpret them as numbers "base ". Every corresponding to some integer then has working values of , corresponding to all ways to replace a with a in 's binary representation.
For optimality, we use strong induction. The base case of holds as .
Now assume . If has no working pairs , we are done. Otherwise, let be an integer so that there is at least one pair so that .
Let be the graph of such pairs in . If is not connected, we can increase the number of edges of by shifting the vertices of one component of to create at least one edge to another component. Thus we can assume that all elements of are sums of powers of . For an element , let be the coefficient of in the representation of as a sum.
Let be the set of so that and let be the set of so that . Note that . By strong induction, there are at most working pairs in , and at most pairs in . By definition of and , any pair between them can only have one possible difference, namely . Thus, there are at most pairs between them.
Thus, we have the recurrence . It thus suffices to show that if , , which expands to
An exercise to the interested reader is to show this by strong induction on .
Now it remains to evaluate . By linearity of expectation, is equal to . For every number from to , digits must be and the remaining four each have a half chance of being , giving . Similarly , is just the number of ones in is . Thus the answer is