# Integer divisors

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

List every positive divisor of a positive integer, ascending.

**Use when you need to: integer divisors · list divisors · all factors of a number.**

## Supported

- integer divisors
- list divisors
- all factors of a number

## Not supported

- divisors of 0 or negative integers
- divisor count only
- sum of divisors

## Behavior

- value is a canonical positive integer string from 1 to 1000000000000 (10^12) inclusive.
- 0 and negative values are rejected: divisors are only defined here for positive integers.
- value 1 returns divisors ["1"].
- divisors lists every positive integer that evenly divides value, ascending, as canonical integer strings, including 1 and value itself.
- Derived from the exact prime factorization by trial division up to sqrt(value), bounded by the 10^12 input cap for predictable running time.
- If value would have more than 100000 divisors the request is rejected rather than returning a truncated list (this cannot occur below the 10^12 cap for any tested value, but the guard exists for defense in depth).

## Input

- `value` (string, required): max length 13; pattern `^[1-9][0-9]*$`

## Output

- `divisors` (array of string, required)

## Limits

- max value: 1000000000000
- max digits: 13
- max divisors output: 100000

## Example

Request input:

```json
{
  "value": "12"
}
```

Response:

```json
{
  "result": {
    "divisors": [
      "1",
      "2",
      "3",
      "4",
      "6",
      "12"
    ]
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "integer-divisors",
  "version": "1.0.0",
  "input": {
    "value": "12"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/integer-divisors/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"value":"12"}'
```

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

### CLI

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

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

## Related tools

- [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 rational sum](/tools/array-rational-sum): Sum an array of canonical rationals and return the reduced total.
- [Integer digit sum](/tools/integer-digit-sum): Sum the base-b digits of the magnitude of an integer string.
- [Integer is perfect square](/tools/integer-is-perfect-square): Test whether a non-negative integer string is a perfect square.
