6. Let the integer $n>4,(x+2 \sqrt{y}-1)^{n}$, the coefficients of $x^{n-1}$ and $x y$ in the expansion are equal, then the value of $n$ is

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
Answer: 51.
Solution: Notice that $(x+2 \sqrt{y}-1)^{n}=\sum_{n=0}^{n} \mathrm{C}_{n}^{r} x^{n-1}(2 \sqrt{y}-1)^{r}$.
The term $x^{n-4}$ appears only in the expansion $\mathrm{C}_{n}^{4} x^{n-4}(2 \sqrt{y}-1)^{4}$ when the summation index $r=4$, and the coefficient of the $x^{n-4}$ term is $(-1)^{4} \mathrm{C}_{n}^{4}=\frac{n(n-1)(n-2)(n-3)}{24}$.

The term $x y$ appears only in the expansion $\mathrm{C}_{n}^{n-1} x \cdot(2 \sqrt{y}-1)^{n-1}$ when the summation index $r=n-1$, and the coefficient of the $x y$ term is $\mathrm{C}_{n}^{n-1} \mathrm{C}_{n-1}^{2} 4 \cdot(-1)^{n-3}=(-1)^{n-3} 2 n(n-1)(n-2)$.

Therefore, we have $\frac{n(n-1)(n-2)(n-3)}{24}=(-1)^{n-3} 2 n(n-1)(n-2)$. Noting that $n>4$, simplifying gives $n-3=(-1)^{n-3} 48$, so it must be that $n$ is odd and $n-3=48$. Solving yields $n=51$.