# Integer prime factors

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

Compute the prime factorization of a positive integer as a list of prime/exponent pairs.

**Use when you need to: integer prime factors · prime factorization · factorize integer.**

## Supported

- integer prime factors
- prime factorization
- factorize integer

## Not supported

- factorization of 0 or negative integers
- probabilistic factorization
- divisor listing

## Behavior

- value is a canonical positive integer string from 1 to 1000000000000 (10^12) inclusive.
- 0 and negative values are rejected: prime factorization is only defined here for positive integers.
- value 1 returns an empty factors array (the empty product).
- factors is sorted ascending by prime, each entry { prime, exponent } with prime a canonical positive integer string and exponent a positive JSON integer.
- Every listed prime, multiplied by itself exponent times across all entries, reconstructs value exactly.
- Factorization uses exact trial division up to sqrt(value), bounded by the 10^12 input cap for predictable running time.

## Input

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

## Output

- `factors` (array of object, required)

## Limits

- max value: 1000000000000
- max digits: 13

## Example

Request input:

```json
{
  "value": "360"
}
```

Response:

```json
{
  "result": {
    "factors": [
      {
        "prime": "2",
        "exponent": 3
      },
      {
        "prime": "3",
        "exponent": 2
      },
      {
        "prime": "5",
        "exponent": 1
      }
    ]
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "integer-prime-factors",
  "version": "1.0.0",
  "input": {
    "value": "360"
  }
}
```

### HTTP (no key)

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

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

### CLI

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

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

## Related tools

- [Integer divisors](/tools/integer-divisors): List every positive divisor of a positive integer, ascending.
- [Integer is prime](/tools/integer-is-prime): Deterministically test whether a non-negative integer string is prime.
- [Array integer adjacent diff](/tools/array-integer-adjacent-diff): Replace an array of canonical integer strings with consecutive first differences.
- [Array integer clamp](/tools/array-integer-clamp): Clamp an array of canonical integer strings to optional inclusive min and max bounds.
- [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.
