EvenQ

EvenQ[expr]

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

Details

  • EvenQ[expr] returns False unless expr is manifestly an even integer (i.e. has head Integer, and is even).

Examples

open allclose all

Basic Examples  (2)

Test whether 8 is even:

EvenQ gives False for non-numeric expressions:

Applications  (1)

Test whether an array consists of even integers:

Properties & Relations  (3)

An integer is either odd or even. Use OddQ to check that an integer is odd:

Even integers are divisible by 2:

The generating function of the even integers is :

Possible Issues  (1)

Expressions that represent even integers but do not evaluate explicitly will still give False:

It is necessary to use symbolic simplification first:

Introduced in 1988
 (1.0)