Legendre symbol in theory of numbers
\documentclass[a4paper]{article}
\usepackage{amsmath}
\makeatletter
\def\legendre@dash#1#2{\hb@xt@#1{%
\kern-#2\p@
\cleaders\hbox{\kern.5\p@
\vrule\@height.2\p@\@depth.2\p@\@width\p@
\kern.5\p@}\hfil
\kern-#2\p@
}}
\def\@legendre#1#2#3#4#5{\mathopen{}\left(
\sbox\z@{$\genfrac{}{}{0pt}{#1}{#3#4}{#3#5}$}%
\dimen@=\wd\z@
\kern-\p@\vcenter{\box0}\kern-\dimen@\vcenter{\legendre@dash\dimen@{#2}}\kern-\p@
\right)\mathclose{}}
\newcommand\legendre[2]{\mathchoice
{\@legendre{0}{1}{}{#1}{#2}}
{\@legendre{1}{.5}{\vphantom{1}}{#1}{#2}}
{\@legendre{2}{0}{\vphantom{1}}{#1}{#2}}
{\@legendre{3}{0}{\vphantom{1}}{#1}{#2}}
}
\def\dlegendre{\@legendre{0}{1}{}}
\def\tlegendre{\@legendre{1}{0.5}{\vphantom{1}}}
\makeatother
\begin{document}
$\genfrac(){}{0}{a}{b}$
$\dlegendre{a}{b}\dlegendre{10}{20}$
$\genfrac(){}{}{a}{b}\legendre{a}{b}\legendre{100}{200}$
$\scriptstyle\genfrac(){}{}{a}{b}\legendre{a}{b}\legendre{10}{20}$
$\scriptscriptstyle\genfrac(){}{}{a}{b}\legendre{a}{b}\legendre{10}{20}$
$\displaystyle\legendre{a}{b}\textstyle\legendre{a}{b}
\scriptstyle\legendre{a}{b}\scriptscriptstyle\legendre{a}{b}$
\end{document}
The user command are \legendre
that typesets the symbol in the current math style or \dlegendre
and \tlegendre
to force display or text style.
The \genfrac
parts are only for comparisons.
Interesting question. My first idea was to write In french the symbol is
$\left(\dfrac{a}{b}\right)$
but without dashed line, the second idea was to use \genfrac
but I don't know how to draw the dashed line so the last idea is to use arydshln
\documentclass[10pt]{article}
\usepackage{amsmath,arydshln}
\def\Legendre(#1,#2){%
\begin{pmatrix}
#1\cr
\hdashline[1pt/1pt]
#2\cr
\end{pmatrix}}
\begin{document}
$\Legendre(97,37)$
\end{document}