next up previous contents index
suivant: Jacobi symbol : jacobi_symbol monter: Integers (and Gaussian Integers) précédent: The Euler indicatrix :   Table des matières   Index


Legendre symbol : legendre_symbol

If n is prime, we define the Legendre symbol of a written $ \left(\vphantom{\frac{a}{n}}\right.$$ {\frac{{a}}{{n}}}$$ \left.\vphantom{\frac{a}{n}}\right)$ by :

$\displaystyle \left(\vphantom{\frac{a}{n}}\right.$$\displaystyle {\frac{{a}}{{n}}}$$\displaystyle \left.\vphantom{\frac{a}{n}}\right)$ = $\displaystyle \left\{\vphantom{\begin{array}{rl}
0 & \mbox{if }a=0\ \bmod n \\ ...
...f } a \neq 0 \bmod n \mbox{ and if } a \neq b^2 \bmod n\\
\end{array}}\right.$$\displaystyle \begin{array}{rl}
0 & \mbox{if }a=0\ \bmod n \\
1 & \mbox{if } ...
... \mbox{if } a \neq 0 \bmod n \mbox{ and if } a \neq b^2 \bmod n\\
\end{array}$

Some properties legendre_symbol takes two arguments a and n and returns the Legendre symbol $ \left(\vphantom{\frac{a}{n}}\right.$$ {\frac{{a}}{{n}}}$$ \left.\vphantom{\frac{a}{n}}\right)$.
Input :
legendre_symbol(26,17)
Output :
1
Input :
legendre_symbol(27,17)
Output :
-1
Input :
legendre_symbol(34,17)
Output :
0



giac documentation written by Renée De Graeve and Bernard Parisse