The n-tuples we seek are the ones satisfying the following condition:
if there are exactly r odd numbers in a2,…,an, then 2r∣a1−1. (∗)
We first verify the necessity of (∗). For this, we drop the condition an≥an−1≥⋯≥a1 and assume that a1,…,ar are odd and ar+1,…,an are even. Suppose that we are given the M tuples satisfying the requirement (2). For each s∈Z, denote Bs={i∣1≤i≤M,ci,n≡s(modan)}. Then
∣B1∣+∣B2∣+⋯+∣Ban∣=M.
Consequently, there exists an index s such that ∣Bs∣+∣Bs+1∣≥an/2M. This means that we can choose at least an/2M tuples such that the differences between their n-th coordinates ci,n are all congruent to 0 or ±1 modulo an.
By running the same argument for all the tuples inductively, i.e., to consider the (n−1)th coordinates modulo an−1, the (n−2)th coordinates modulo an−2, etc., it eventually shows that there are at least 2an…2a2M=2a1−1 tuples such that for each two of them, the differences between their kth coordinates ci,k's are congruent to 0 or ±1 modulo ak, where 2≤k≤n. However, the given conditions imply that the difference between the first coordinates of these tuples can not be 0 or ±1 (mod a1); there are at most 2a1−1 such tuples. This means that all equalities must hold in the argument above. Namely, for each t we have exactly 2an…2atM different tuples. In particular, taking t=r+1 leads to
2an…2ar+1M=2r1(a1−1)a2…ar∈Z.
It forces that 2r∣a1−1.
In the following, we construct the needed M tuples under the condition 2r∣a1−1. For convenience, we first weaken the condition an≥an−1≥⋯≥a1 to only requiring a1=min{a1,…,an}. Whenever there is any even number in a2,…,an, say an without loss of generality. Suppose that we may construct the needed tuples for a1,…,an−1, say (ci,1,ci,2,…,ci,n−1) with 1≤i≤M′=2n−11(a1−1)a2…an=an2M. Then it suffices to take (ci,1,ci,2,…,ci,n−1,2c) with 1≤i≤M′ and 1≤c≤2an.
Now it remains to prove for the case when all a2,a3,…,an are odd. Let us write a1=2nt+1 and consider the case when a1=a2=⋯=an first. In this case, M=ta1n−1. Define the function f(x1,x2,…,xn−1)=∑i=1n−12ixi and take the following M=ta1n−1 tuples:
(x1,x2,…,xn−1,f(x1,…,xn−1)+2ns),
where x1,…,xn−1∈{1,2,…,a1},s∈{1,…,t}. We now show that these tuples satisfy the desired conditions. Consider the above tuple together with another one: (x1′,x2′,…,xn−1′,f(x1′,…,xn−1′)+2ns′). If for every k, the difference between their kth coordinate ≡0,±1(moda1), then
xi−xi′≡0,±1(moda1),i=1,…,n−1; and
i=1∑n−12i−1(xi−xi′)+2n(s−s′)≡0,±1(moda1).(∗)
The first equality implies that ∑i=1n−12i(xi−xi′) can be only congruent to 2n−1−1,2n−2−1,…,1−2n−1(moda1). On the other hand, s−s′∈{1−t,2−t,…,t−1}. So s is forced to be equal to s′ by (∗), and ∑i=1n−12i−1(xi−xi′)=0(moda1). By the uniqueness of binary expansion, we get xi=xi′(moda1), which implies that the two tuples are the same. This verifies that the constructed tuples satisfy the needed conditions.
For the general case where a1,…,an are all odd numbers, we claim that if a2>a1, the construction can be reduced to the case with a1,a2−2,a3,…,an. Hence by induction, it suffices to consider the case where all ai are equal, which is discussed above.
Assume now there exist M′=2n1(a1−1)(a2−2)a3⋯an tuples as desired when a1′=a1,a2′=a2−2,a3′=a3,…,an′=an. We may assume that for each k, the kth coordinates of all these tuples belong the set {0,1,…,ak′−1}.
We then define the M=2n1(a1−1)a2a3⋯an tuples as follows. One can first choose the M′ tuples that are already defined. As for x2=a2−2, we choose to add the tuple (x1,a2−2,x3,…,xn) if and only if the tuple (x1,a2−4,x3,…,xn) was selected; and for x2=a2−1, we choose to add the tuple (x1,a2−1,x3,…,xn) if and only if the tuple (x1,a2−3,x3,…,xn) was selected. It is easy to check that these tuples satisfy our requirement. Also, using the proof for 2r∣a1−1 by induction, the condition for equality implies the following: Among the M′ tuples we have selected before, the number of tuples whose second coordinate is either a2−1 or a2−2 is M′⋅a2−22. Hence we can the number of new tuples is M′+M′⋅a2−22=M. This completes the construction of the tuples.