6. Let the side length of a regular $n$-sided polygon be $a$, and the longest and shortest diagonals be $b$ and $c$ respectively. If $a=b-c$, then $n=$ $\qquad$
6. 9 .

Let the diameter of the circumcircle of a regular $n$-sided polygon be 1.
When $n=2k$,
$b=1, c=\sin \frac{\pi}{k}, a=\sin \frac{\pi}{2k}$.
Thus, $f(k)=\sin \frac{\pi}{k}+\sin \frac{\pi}{2k}=1$.
Since the function $f(k)$ is monotonically decreasing, and $f(4)>1>f(5)$,
there is no solution in this case.
When $n=2k+1>5$,
\[
\begin{array}{l}
b=\sin \frac{k \pi}{2 k+1}, c=\sin \frac{2 \pi}{2 k+1}, a=\sin \frac{\pi}{2 k+1}. \\
\text{Thus, } \sin \frac{2 \pi}{2 k+1}+\sin \frac{\pi}{2 k+1} \\
=\sin \frac{k \pi}{2 k+1}=\cos \frac{\pi}{2(2 k+1)}.
\end{array}
\]

Let $x=\frac{\pi}{2(2 k+1)}$. Then $\cos x \neq 0$.
Thus, $\sin 4 x+\sin 2 x=\cos x$
\[
\begin{array}{l}
\Rightarrow 2 \sin 3 x \cdot \cos x=\cos x \Rightarrow \sin 3 x=\frac{1}{2} \\
\Rightarrow 3 x=\frac{\pi}{6} \Leftrightarrow \frac{3 \pi}{2(2 k+1)}=\frac{\pi}{6} \\
\Rightarrow 2 k+1=9 \Rightarrow n=9.
\end{array}
\]

Verification shows that $n=9$ is the only solution.
Therefore, the solution is a regular nonagon.