even
Returns true
iff its argument is an even number.
Syntax
-
even(n)
-
n
is an integer
-
Description
even(n)
is true
iff n
is an even number (that is, on the form 2m for some integer m).
If the argument isn’t an integer, an error is generated.
Examples
pick(SequenceList(1000) @ prime, even)
2
L ≔ SequenceList(1000); count(L, even)/#L
1/2 (=0.5)
L ≔ SequenceList(10000) @ (n ↦ mod(n^2, 19)); count(L, even)/#L
737/2000 (=0.3685)