Kronecker Symbol

Author

Eric W. Weisstein
March 30, 2006

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/KroneckerSymbol.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/KroneckerSymbol.html.

©2006 Wolfram Research, Inc. except for portions noted otherwise

Initialization

<<NumberTheory`NumberTheoryFunctions`

Usage

?KroneckerSymbol

Definition

Now obviated by the NumberTheory`NumberTheoryFunctions` definition

MyKroneckerSymbol[k_,n_]:=Module[{nt=IntegerExponent[n,2]},If[nt==0,
JacobiSymbol[k,n],JacobiSymbol[k,n/2^nt]*Which[
Mod[k,2]==0,0,
Abs[Mod[k,8,-4]]==1,1,
Abs[Mod[k,8,-4]]==3,(-1)^nt
]
]
]

Table[MyKroneckerSymbol[k,n]-KroneckerSymbol[k,n],{k,10},{n,10}]

Enumeration

Table[{k,Table[KroneckerSymbol[k,n],{n,20}]},{k,-6,6}]//ColumnForm

Periods

Table[Period[Table[KroneckerSymbol[d,n],{n,4000}]],{d,12}]

Table[Period[Table[KroneckerSymbol[-d,n],{n,4000}]],{d,12}]

Table[KroneckerSymbol[-1,n],{n,20}]

Partition[Table[KroneckerSymbol[2,n],{n,32}],8]//ColumnForm

Partition[Table[KroneckerSymbol[4,n],{n,8}],2]//ColumnForm

Partition[Table[KroneckerSymbol[-4,n],{n,16}],4]//ColumnForm

Partition[Table[KroneckerSymbol[6,n],{n,24 4}],24]//ColumnForm

Plot

<<Utilities`Typesetting`

<<Graphics`Colors`

ListDensityPlot[Table[KroneckerSymbol[k,n],{n,100},{k,100}],Mesh->False,FrameLabel->TraditionalForm/@{k,n},PlotLabel->TraditionalForm[KroneckerSymbol[k,n]],
ColorFunctionScaling->False,
ColorFunction->(Switch[#,-1,Red,0,White,1,Black]&),
ImageSize->300]//Timing

Comparison with JacobiSymbol

Table[JacobiSymbol[m,n],{m,-5,5},{n,-5,5}]//TraditionalForm

Table[KroneckerSymbol[m,n],{m,-5,5},{n,-5,5}]//TraditionalForm