Here's a rather customizable version using LaTeX3.
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
% the user level macro
\NewDocumentCommand{\sigi}{ s O{a} D<>{2} m }
{
\{ % initial delimiter
\IfBooleanTF{#1}
{
\merlin_sigi_nodots:nn { #2 } { #3 }, \dots, #2\sb{#4}
}
{
\merlin_sigi:nnn { #2 } { #3 } { #4 }
}
\} % final delimiter
}
% the inner main function that decides if dots are necessary or not
\cs_new_protected:Npn \merlin_sigi:nnn #1 #2 #3
{
\int_compare:nTF { #3 < #2 }
{\merlin_sigi_nodots:nn { #1 } { #3 } }
{
\int_compare:nTF { #3 <= #2 + 2 }
{ \merlin_sigi_nodots:nn { #1 } { #3 } }
{ \merlin_sigi_dots:nnn { #1 } { #2 } { #3 } }
}
}
% the loop for printing the sequence when no dots are required
\cs_new_protected:Npn \merlin_sigi_nodots:nn #1 #2
{
\int_step_inline:nnnn { 1 } { 1 } { #2 - 1 } { #1\sb{##1}, }
#1\sb{#2}
}
% the loop for printing the sequence when dots are required
\cs_new_protected:Npn \merlin_sigi_dots:nnn #1 #2 #3
{
\int_step_inline:nnnn { 1 } { 1 } { #2 } { #1\sb{##1}, }
\dots,
#1\sb{#3}
}
\ExplSyntaxOff
\begin{document}
$\sigi{3}$
$\sigi{4}$
$\sigi[b]{5}$
$\sigi<3>{10}$
$\sigi[c]<4>{20}$
$\sigi<5>{4}$
$\sigi{1}$
$\sigi{2}$
\bigskip
$\sigi*{n}$
$\sigi*[b]{m}$
$\sigi*[c]<3>{k}$
\end{document}

You can specify both the variable name (default a) and the number of initial indexed elements (default 2). If the number given as argument is less than the default number or one or two bigger, the full list is printed, as a list
{a1,a2,…,a4}
would be rather awkward.
Specification
The \sigi macro has
- One optional argument (in brackets) representing the variable name (default
a)
- One optional argument (between
< and >) representing the number of elements spelled out at the beginning
- A mandatory argument (in braces, as usual) representing the final number
Non positive integer input in the second optional argument or in the mandatory argument will cause errors.
However the macro admits also a *-variant for a "generic" last argument, as shown in the last three lines of input. The syntax is the same for the optional arguments; the mandatory argument can be anything.
Dargument specifier supposed to mean "do not use"? :-) – Sašo Živanović Feb 07 '13 at 21:53\NewDocumentCommandit specifies an optional argument delimited by different characters than brackets. – egreg Feb 07 '13 at 21:56