# Array integer mode

`array-integer-mode` · version 1.0.0 · Numbers & math · free, no key needed

Return the most frequent canonical integers, listing every mode in first-seen order.

**Use when you need to: array integer mode · mode of integer strings · most frequent integers.**

## Supported

- array integer mode
- mode of integer strings
- most frequent integers

## Not supported

- kernel density
- fuzzy clustering
- mean of integers
- CSV column mode

## Behavior

- values is a non-empty array of at most 10000 canonical integer strings (BigInt; -0 becomes 0).
- Frequencies are counted on canonical integer values, not original spellings.
- count is the maximum frequency as a JSON integer.
- modes lists every canonical value that occurs count times, in first-seen order.
- If every value is unique, every value is a mode and count is 1.

## Input

- `values` (array of string, required): min items 1; max items 10000; each min length 1; each max length 1001

## Output

- `modes` (array of string, required): min items 1; max items 10000; each pattern `^(0|-?[1-9][0-9]*)$`
- `count` (integer, required): min 1; max 10000

## Limits

- max values: 10000
- max digits: 1000

## Example

Request input:

```json
{
  "values": [
    "2",
    "1",
    "2",
    "3",
    "1",
    "2"
  ]
}
```

Response:

```json
{
  "result": {
    "modes": [
      "2"
    ],
    "count": 3
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "array-integer-mode",
  "version": "1.0.0",
  "input": {
    "values": [
      "2",
      "1",
      "2",
      "3",
      "1",
      "2"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/array-integer-mode/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"values":["2","1","2","3","1","2"]}'
```

The machine-readable contract is at [/v1/tools/array-integer-mode/versions/1.0.0](/v1/tools/array-integer-mode/versions/1.0.0).

### CLI

```sh
node cli.mjs run array-integer-mode 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Array integer cumulative sum](/tools/array-integer-cumulative-sum): Replace an array of canonical integer strings with equal-length prefix sums.
- [Array integer GCD](/tools/array-integer-gcd): Compute the non-negative greatest common divisor of an array of canonical integer strings.
- [Array integer LCM](/tools/array-integer-lcm): Compute the non-negative least common multiple of an array of canonical integer strings.
- [Array integer median](/tools/array-integer-median): Select lower and upper middle canonical integers; emit median only for odd length.
- [Array integer min max](/tools/array-integer-min-max): Return the numeric minimum and maximum of canonical integer strings.
- [Array integer product](/tools/array-integer-product): Multiply an array of canonical integer strings and return the canonical product.
