Fundamental Discriminant

Author

Eric W. Weisstein
May 9, 2008

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

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

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

Initialization

<<NumberTheory`NumberTheoryFunctions`

Code

fundamentalDiscriminantQ[n_Integer]:=n≠1&&
(Mod[n,4]==1||!Unequal[Mod[n,16],8,12])&&
SquareFreeQ[n/2^IntegerExponent[n,2]]

Usage

?FundamentalDiscriminantQ

List

Select[Range[-20,20],FundamentalDiscriminantQ]

Select[Range[-20,20],fundamentalDiscriminantQ]

With[{n=10^3},Select[Range[-n,n],fundamentalDiscriminantQ]===Select[Range[-n,n],FundamentalDiscriminantQ]]//Timing

Positive

Select[Range[100],FundamentalDiscriminantQ]

Negative

Select[-Range[100],FundamentalDiscriminantQ]