IntegerQ

IntegerQ[expr]

gives True if expr is an integer, and False otherwise.

Details

  • IntegerQ[expr] returns False unless expr is manifestly an integer (i.e. has head Integer).
  • Simplify[exprIntegers] can be used to try to determine whether an expression is mathematically equal to an integer.

Examples

open allclose all

Basic Examples  (1)

IntegerQ tests whether an expression is explicitly an integer:

Applications  (2)

Test whether an array consists of all integers:

Make a test for Gaussian integers:

Properties & Relations  (2)

Integers have head Integer:

An expression may have head Integer, but IntegerQ gives False:

Possible Issues  (1)

Expressions that do not evaluate to integers explicitly will still give False:

It is necessary to use symbolic simplification first:

Wolfram Research (1988), IntegerQ, Wolfram Language function, https://reference.wolfram.com/language/ref/IntegerQ.html (updated 1999).

Text

Wolfram Research (1988), IntegerQ, Wolfram Language function, https://reference.wolfram.com/language/ref/IntegerQ.html (updated 1999).

CMS

Wolfram Language. 1988. "IntegerQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1999. https://reference.wolfram.com/language/ref/IntegerQ.html.

APA

Wolfram Language. (1988). IntegerQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IntegerQ.html

BibTeX

@misc{reference.wolfram_2023_integerq, author="Wolfram Research", title="{IntegerQ}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/IntegerQ.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_integerq, organization={Wolfram Research}, title={IntegerQ}, year={1999}, url={https://reference.wolfram.com/language/ref/IntegerQ.html}, note=[Accessed: 19-March-2024 ]}