Solution:
Suppose that n has one of these forms. For an integer i, let xi be the largest integer such that 2xi divides i. Now assume that 0<i<n, 0<j<n, i=j, n divides 2i+j and xi≥xj. Then the highest power of 2 dividing 2i+j is 2xj and therefore k≤xj and 2k≤j. Since 0<j<n, this is possible only if n=3⋅2k and either j=2k or j=2k+1. In the first case, i=j and xi≥xj imply i=2k+1 leading to the contradiction 3⋅2k=n∣2i+j=5⋅2k. The second case is not possible as i=j and xi≥xj now imply i≥2k+2>n.
Now suppose that n does not have one of these forms and x1,x2,…,xn−1 satisfying the given condition exist. For any positive integer m, let am be the remainder of the division of (−2)m by n. Then none of am is 0 as n is not a power of 2. Also am=am+1 for any m≥1 as am=am+1 would lead to n dividing 3⋅2m. Moreover n divides 2am+am+1. Hence we must have xa1<xa2<xa3<… which is not possible as am's can take on only finitely many values.
Let E={n/3,n/2,2n/3}∩{1,2,…,n−1}, D={1,2,…,n−1}∖E, and let f:D→{1,2,…,n−1} be the function sending i in D to the unique f(i) in {1,2,…,n−1} such that f(i)≡−2i(modn).
Then the condition of the problem is that xi<xf(i) for each i in D. Since D is a finite set, the integers x1,x2,…,xn−1 exist if and only if for each i in D there exists a positive integer k(i) such that fk(i)(i) belongs to E. This can be seen as follows:
- If fk(i) does not belong to E for any k>0 for some i, then there exists k2>k1>0 such that fk1(i)=fk2(i), leading to the contradiction xfk1(i)<xfk2(i)=xfk1(i).
- On the other hand, if such k(i) exists for each i in D, and if k0(i) denotes the smallest such, then the condition of the problem is satisfied by letting xi=−k0(i) for i in D, and xi=0 for i in E.
In other words, the integers x1,x2,…,xn−1 exist if and only if for each i in D there exists a positive integer k(i) such that (−2)k(i)i≡n/3,n/2 or 2n/3(modn). For i=1, this implies that n=2k with k≥1 or n=3⋅2k with k≥0. On the other hand, if n has one of these forms, letting k(i)=k does the trick for all i in D.
Suppose that x1,x2,…,xk−1 satisfy the condition of the problem for n=k. Let y2i=xi for 1≤i≤k−1 and choose y2i−1 for 1≤i≤k to be less than min{x1,x2,…,xk−1}. Now suppose that for n=2k we have 0<i<n, 0<j<n, i=j, n divides 2i+j. Then j is even. If i is also even, then 0<i/2<k, 0<j/2<k and k divides 2(i/2)+(j/2); hence yi=xi/2<xj/2=yj. On the other hand, if i is odd, then yi<min{x1,x2,…,xk−1}≤xj/2=yj. Therefore, y1,y2,…,y2k−1 satisfy the condition of the problem for n=2k.
Since the condition is vacuous for n=2 and n=3, it follows that x1,x2,…,xn−1 satisfying the condition exist for all n=2k with k≥1 and n=3⋅2k with k≥0.
Now suppose that x1,x2,…,xn−1 satisfying the condition of the problem exist for n=2km where k is a nonnegative integer and m>3 is an odd number. Let b0=2k and let bi+1 be the remainder of the division of (−2)bi by n for i≥0. No terms of this sequence is 0 and no two consecutive terms are both equal to b1 as m>3. On the other hand, as (−2)ϕ(m)≡1(modm), we have bϕ(m)≡(−2)ϕ(m)2k≡2k≡b0(modn), and hence bϕ(m)=b0. Since 2bi+bi+1 is divisible by n for all i≥0, we have xb0<xb1<⋯<xbϕ(m)=xb0, a contradiction.