Problem:
The number is written on the blackboard. After that a sequence of numbers is created as follows: at each step each number on the blackboard is replaced by the numbers and ; if the number occurs, it is erased immediately; if a number occurs more than once, all its occurrences are left on the blackboard. Thus the blackboard will show after steps; after step; after steps; after steps, and so on. How many numbers will there be on the blackboard after steps?
Solutions — 2
Solution 1
Solution:
Let be a set of different numbers, all of them less than , and create two new sets as follows: , consisting of all the numbers in except the smallest one, and , with elements the smallest element of and all the numbers we get by adding to each number in . Note that if the number of elements in is , then has elements, and has elements. This corresponds to the operations we are allowed to perform on the blackboard, if we throw away all empty sets. If we now operate simultaneously on the sets and on the numbers, then after steps the number of sets will be exactly equal to the number of numbers on the blackboard.
Let us see what the set operations look like. We must start with a set, consisting only of the number . Next we get an empty set (thrown away), and the set ; next the sets and ; next again (an empty set and) , etc.
It is now fairly easy to prove by induction that after steps
(1) each number less than appears in exactly one set;
(2) the number of elements in the sets corresponds exactly to the numbers on the blackboard;
(3) if the numbers in each set are written in increasing order, then the difference between two neighbours is a power of ; thus the binary representations of two neighbours differ in exactly one position (in the binary system the example above looks like this: );
(4) if is the number of ones in the binary code of the smallest number of a set, and the number of ones in the largest number of the same set, then ;
(5) each set contains exactly one number with ones.
The last property tells us that the number of sets after steps is equal to the number of numbers such that their binary representation contains exactly ones out of digits, i.e. the number of numbers on the blackboard after steps will be equal to .
Solution 2
Solution:
Denote by the number of numbers on the blackboard after steps (thus , , , ). Regard all points in the plane with coordinates , where are defined as follows: the number is written on the blackboard after steps ( are positive integers by the condition). At each node, i.e. each point with integer coordinates of the above type, write the number of occurrences of after steps. Thus the number written at will be the number of occurrences of directly after step , which is . Observe that the number at each node is equal to the number of ways to reach this node from the point , walking from one node to another one step at the time, from left to right and either up or down, without going down to the horizontal axis.
(Since all zeroes are erased, we can never reach the horizontal axis.) For each we want to find the total number of paths , reaching the vertical line .
If we were to remove the constraint that we are not allowed to step on the horizontal axis (i.e. that all zeroes are erased), we would get Pascal's triangle, and the total number of paths would be . The binomial coefficient at each node is then the total number of paths to reach this node, without constraint.
We need to find and subtract the number of paths from to a point among the allowed nodes, which go down to the horizontal axis. Choose such a path, and find a new one by reflecting in the horizontal axis the part between the starting point and the path's first contact with the horizontal axis. The original path and the reflected one will end at the same point (among the allowed nodes); the reflected one will start at . We have constructed a bijection between the original set of paths from to that reach down to the horizontal axis and the set of paths from to . Observe that starting at we can get another copy of Pascal's triangle, which is the original one, translated two units down. It is easier to count the number of paths from to , since they are not subject to any constraints. Thus the number of "positive" paths from to the points above the horizontal axis for will be
In case is odd, a modification of the above argument gives the answer obtained in Solution I.