﻿ IsInteger – Algosim documentation
Algosim documentation: IsInteger

# IsInteger

Tests if an object is an integer.

## Syntax

• `IsInteger(x)`

• `x` is any object

## Description

`IsInteger(x)` returns `true` iff `x` is an integer. This is the case iff

• technically, the type of `x` is any number type (integer, rational number, real number, or complex number), and

• the value of the number is, mathematically, an integer.

For example, the following statements will evaluate to `true`:

• `IsInteger(5) // type: integer `

• `IsInteger(1/3 + 2/3) // type: rational number `

• `IsInteger(5.0) // type: real number `

• `IsInteger(2 + i − i) // type: complex number `

The following statements will evaluate to `false`:

• `IsInteger(1/3 + 1/3) // type: rational number `

• `IsInteger(5.5) // type: real number `

• `IsInteger(1 + i) // type: complex number `

• `IsInteger(❨394❩) // type: real vector `

• `IsInteger(❨❨713❩❩) // type: real matrix `

• `IsInteger('(687)) // type: list `

• `IsInteger({49}) // type: set `

## Examples

`f ≔ n ↦ n⋅(n/5 − 1/8)⋅(n/3 − 1/7)`
`custom function`
`count(SequenceList(10000) @ f, IsInteger)`
`188`
`max(filter(collapse(SequenceList(10000) @ f @ IsInteger), (x ↦ ¬x[1])) @ (x ↦ x[2]))`
`183`
`count(SequenceList(10000) @ f, (n ↦ IsInteger(n) ∧ odd(n)))`
`93`
`max(filter(collapse(SequenceList(10000) @ f @ (n ↦ IsInteger(n) ∧ odd(n))), (x ↦ ¬x[1])) @ (x ↦ x[2]))`
`239`