6. The maximum value is a1a2⋯an.
If xi=ai(1⩽i⩽n), then x1,x2,⋯,xn satisfy the conditions, and x1x2⋯xn=a1a2⋯an.
Next, we prove: x1x2⋯xn⩽a1a2⋯an.
When k=1, the conclusion is obvious. By the condition, we have xi⩽ai(1⩽i⩽n).
Assume k⩾2.
Without loss of generality, let
a1−x1⩽a2−x2⩽⋯⩽an−xn.
If a1−x1⩾0, then ai⩾xi(1⩽i⩽n), and the conclusion is obviously true.
Assume a1−x1<0,
$0 d s+1 d k d n .
From equation (1), we know
−i=1∑sdi+i=s+1∑kdi⩾0⇒i=s+1∑kdi⩾i=1∑sdi.
Let M=∑i=1sdi,N=∑i=s+1ndi. Then
n−sN=n−s∑i=s+1ndi⩾k−s∑i=s+1kdi⩾k−sM.
Notice that, for j>s, we have dj<aj<k.
Using the AM-GM inequality, we get
∏i=1naixi=(∏i=1s(1+aidi))(∏j=s+1n(1−ajdj))⩽(∏i=1s(1+k−1di))(∏j=s+1n(1−kdj))⩽(n1(∑i=1s(1+k−1di)+∑i=s+1n(1−kdi)))n=(1+n(k−1)M−nkN)n⩽(1+n(k−1)M−nk(k−s)(n−s)M)n⩽(1+n(k−1)M−nk(k−s)(k+1−s)M)n=(1+nkM(k−1k−k−sk−s+1))n⩽1.
Thus, the conclusion is proved.