Maths Olympiad Prep

Library / /1370 of 1394

Combinatorics Difficulty 6.3 National Olympiad Prove it United States

Problem:

For how many pairs of sequences of nonnegative integers (b1,b2,,b2018)\left(b_{1}, b_{2}, \ldots, b_{2018}\right) and (c1,c2,,c2018)\left(c_{1}, c_{2}, \ldots, c_{2018}\right) does there exist a sequence of nonnegative integers (a0,,a2018)\left(a_{0}, \ldots, a_{2018}\right) with the following properties:
- For 0i2018,ai<220180 \leq i \leq 2018, a_{i}<2^{2018};
- For 1i2018,bi=ai1+ai1 \leq i \leq 2018, b_{i}=a_{i-1}+a_{i} and ci=ai1aic_{i}=a_{i-1} \mid a_{i};
where \mid denotes the bitwise or operation?
(The bitwise or of two nonnegative integers x=x3x2x1x0x=\cdots x_{3} x_{2} x_{1} x_{0} and y=y3y2y1y0y=\cdots y_{3} y_{2} y_{1} y_{0} expressed in binary is defined as xy=z3z2z1z0x \mid y=\cdots z_{3} z_{2} z_{1} z_{0}, where zi=1z_{i}=1 if at least one of xix_{i} and yiy_{i} is 1 , and 0 otherwise.)

Solution

Solution:

Define the bitwise and of two nonnegative integers x=x3x2x1x0x=\cdots x_{3} x_{2} x_{1} x_{0} and y=y3y2y1y0y=\cdots y_{3} y_{2} y_{1} y_{0} expressed in binary to be x&y=z3z2z1z0x \& y=\cdots z_{3} z_{2} z_{1} z_{0}, where zi=1z_{i}=1 if both xix_{i} and yiy_{i} are 1 , and 0 otherwise.
Now, we can prove that from the definitions of \mid and &\& that x+y=(xy)+(x&y)x+y=(x \mid y)+(x \& y). Therefore it suffices to count pairs of sequences (c1,c2,,c2018)\left(c_{1}, c_{2}, \ldots, c_{2018}\right) and (d1,d2,,d2018)\left(d_{1}, d_{2}, \ldots, d_{2018}\right) such that ci=ai1aic_{i}=a_{i-1} \mid a_{i} and di=ai1&aid_{i}=a_{i-1} \& a_{i} for 0ai<220180 \leq a_{i}<2^{2018}.
Since both ,&\mid, \& are bitwise operations, it suffices to count the number of sequences {ci}\left\{c_{i}\right\} and {di}\left\{d_{i}\right\} restricting each aia_{i} to {0,2k}\left\{0,2^{k}\right\} for each k[0,2017]k \in[0,2017] and multiply these counts together. Each sequence (a0,,a2018)\left(a_{0}, \ldots, a_{2018}\right) leads to a unique {ci}\left\{c_{i}\right\} and {di}\left\{d_{i}\right\} except for the sequences (2k,0,2k,0,,2k)\left(2^{k}, 0,2^{k}, 0, \ldots, 2^{k}\right) and the sequences (0,2k,0,2k,,0)\left(0,2^{k}, 0,2^{k}, \ldots, 0\right), which lead to the same {ci}\left\{c_{i}\right\} and {di}\left\{d_{i}\right\}.
Therefore for each kk, there are 2201912^{2019}-1 ways to determine the kk-th bits of each cic_{i} and did_{i}. Multiplying this over all kk gives a final count of (220191)2018\left(2^{2019}-1\right)^{2018}.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.