# How to code a way of directly writing a sequence of observations

I am trying to code my one notation such that I do not want to repeat every time I need to introduce a new sequence. I thought of coding it this way

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiter\sequence1{\{}{\}_{i=1}^{n}}

\begin{document}
$\sequence1{X_i}$
\end{document}


For some reason this is not working for me. Can some one help

I am expecting to code \sequence1{X_i} and it gives me \$\{X_i\}_{i=1}^{n} on latex.

It's as simple as removing the number from the command sequence name.

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiter\sequence{\{}{\}_{i=1}^{n}}

\begin{document}
$\sequence{X_i}$
\end{document}