AlgebraicIntegerQ
Details
- AlgebraicIntegerQ is typically used to test whether a number is an algebraic integer or not.
- An algebraic integer is a number that is a root of a polynomial with integer coefficients and leading coefficient 1.
- AlgebraicIntegerQ[a] returns False unless a is manifestly an algebraic integer.
Examples
open all close allBasic Examples (2)
Scope (4)
AlgebraicIntegerQ works over integers:
AlgebraicIntegerQ[5]AlgebraicIntegerQ[1.2]AlgebraicIntegerQ[(1 + I) / Sqrt[2]]AlgebraicIntegerQ[Pi]AlgebraicIntegerQ[2 ^ (1 / 3) + 4 ^ (1 / 5) + 17]Root objects:
AlgebraicIntegerQ[Root[2#1 ^ 2 - 2 #1 + 7&, 1]]AlgebraicNumber objects:
AlgebraicIntegerQ[AlgebraicNumber[Sqrt[2], {2, 1}]]AlgebraicIntegerQ threads over lists:
AlgebraicIntegerQ[{E, Sqrt[-2], 1 / Sqrt[2]}]Applications (10)
Basic Applications (2)
Generate random algebraic integers:
randomAlgebraicInteger[n_, m_ : 1] :=
Table[Root[Dot[RandomInteger[20, n], # ^ Range[0, n - 1]] + # ^ n, RandomInteger[{1, n}]], {m}];randomAlgebraicInteger[8, 10]AlgebraicIntegerQ[%]ComplexListPlot[randomAlgebraicInteger[20, 1000]]Plot the field of at most
-degree algebraic integers in the complex plane:
data = Flatten[Table[Root[# ^ 3 + a * # ^ 2 + b * # + c, m], {a, -10, 10}, {b, -10, 10}, {c, -10, 10}, {m, 3}]];ComplexListPlot[data, PlotRange -> {{-3, 3}, {-3, 3}}, AspectRatio -> 1]Special Sequences (3)
Gaussian integers are complex numbers of the form
where a and b are integers:
g = Flatten[Table[a + b I, {a, -40, 40}, {b, -40, 40}]];Gaussian integers are algebraic integers:
AllTrue[g, AlgebraicIntegerQ]p = Select[g, PrimeQ[#, GaussianIntegers -> True]&];ComplexListPlot[p, PlotRange -> All, PlotMarkers -> {{●, 1}}, Axes -> False, AspectRatio -> 1]Eisenstein integers are complex numbers of the form
where a and b are integers and ω is the cube root of unity
:
ω = Exp[2π I / 3];e = Select[Flatten[Table[a + b ω, {a, -30, 30}, {b, -30, 30}], 1], Abs[#] < 20&];Eisenstein integers are algebraic integers:
AllTrue[e, AlgebraicIntegerQ]Check whether an Eisenstein integer is prime:
primeQ[a_] := Or[PrimeQ[AlgebraicNumberNorm[a]], (PrimeQ[Abs[a]] && Mod[Abs[a], 3] == 2)]primeQ[ω]primeQ[5]primes = Select[e, primeQ];ComplexListPlot[primes, PlotRange -> All, PlotMarkers -> Automatic, Axes -> False, AspectRatio -> 1]A Pisot number is a positive algebraic integer greater than 1, all of whose conjugate elements have absolute value less than 1 [more info]:
pisotNumberQ[a_] := AlgebraicIntegerQ[a] && Element[a, Reals] && (a > 1) && (Count[List @@ (Last /@ Roots[MinimalPolynomial[a, x] == 0, x]), _ ? (Abs[#] > 1 &)] == 1)pisotNumberQ[GoldenRatio]pisotNumberQ[Root[-1 - #1 + #1 ^ 3 &, 1]]Number Theory (5)
For every rational number q there exists a nonzero integer n such that
is an algebraic integer:
AlgebraicNumberDenominator[1 / 6]AlgebraicIntegerQ[6 * (1 / 6)]All roots of unity are algebraic integers:
Exp[(2Pi Range[0, 6]I) / 6]AlgebraicIntegerQ[%]Quadratic integers are algebraic integers of degree two:
x /. Solve[x^2 + 2x + 3 == 0, x]AlgebraicIntegerQ[%]The only integers that are both algebraic integers and algebraic units are
and
:
x /. Solve[x * y == 1, {x, y}, Integers]{AlgebraicIntegerQ[1], AlgebraicIntegerQ[-1]}{AlgebraicUnitQ[1], AlgebraicUnitQ[-1]}Use the roots of unity to find Cyclotomic polynomials:
roots = Exp[2 Pi I / Range[5]]MinimalPolynomial[roots, x]Cyclotomic[Range[5], x]Properties & Relations (8)
The sum and product of two algebraic integers are algebraic integers:
{a, b} = {Sqrt[7], Exp[I Pi / 2]};{AlgebraicIntegerQ[a + b], AlgebraicIntegerQ[a * b]}An algebraic integer raised to a rational power is an algebraic integer:
AlgebraicIntegerQ[Sqrt[2] ^ (4 / 3)]Algebraics represents the domain of all algebraic numbers, including algebraic integers:
Element[Sqrt[2] ^ 5 + 3 ^ (4 / 7), Algebraics]An algebraic unit is a number for which both it and its reciprocal are algebraic integers.
a = 1 - 6 6 ^ (1 / 3) + 3 36 ^ (1 / 3);AlgebraicIntegerQ [{a, 1 / a}]AlgebraicUnitQ [a]The roots of monic polynomials with integer coefficients are algebraic integers:
AlgebraicIntegerQ[Root[# ^ 2 - 3 # - 1&, 1]]AlgebraicIntegerQ[Root[# ^ 2 - 3 # - 1&, 2]]Use MinimalPolynomial to find the minimal polynomial of an algebraic integer:
MinimalPolynomial[Sqrt[2], x]Its roots are all algebraic integers:
x /. Solve[% == 0, x]AlgebraicIntegerQ /@ %Use NumberFieldIntegralBasis to get the integral basis for a number field:
a = NumberFieldIntegralBasis[3 ^ (1 / 3)]Any integer linear combination will be an algebraic integer:
AlgebraicIntegerQ[a.{1, 2, 3}]Fundamental units of a number field are algebraic integers:
a = Root[-2 + 5# ^ 4&, 1];
units = NumberFieldFundamentalUnits[a];AlgebraicIntegerQ[units]Tech Notes
Related Guides
History
Text
Wolfram Research (2007), AlgebraicIntegerQ, Wolfram Language function, https://reference.wolfram.com/language/ref/AlgebraicIntegerQ.html.
CMS
Wolfram Language. 2007. "AlgebraicIntegerQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AlgebraicIntegerQ.html.
APA
Wolfram Language. (2007). AlgebraicIntegerQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AlgebraicIntegerQ.html
BibTeX
@misc{reference.wolfram_2026_algebraicintegerq, author="Wolfram Research", title="{AlgebraicIntegerQ}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/AlgebraicIntegerQ.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_algebraicintegerq, organization={Wolfram Research}, title={AlgebraicIntegerQ}, year={2007}, url={https://reference.wolfram.com/language/ref/AlgebraicIntegerQ.html}, note=[Accessed: 12-June-2026]}