# Integer sqrt

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

Compute the exact floor of the square root of a non-negative integer string.

**Use when you need to: integer sqrt · integer square root · floor square root.**

## Supported

- integer sqrt
- integer square root
- floor square root

## Not supported

- negative square root
- floating-point square root
- nth root

## Behavior

- value is a canonical non-negative integer string: 0 or a non-zero leading digit followed by digits, at most 1000 digits.
- Negative values are rejected.
- The result is floor(sqrt(value)), computed exactly by integer Newton iteration (no floating point).
- is_perfect_square is true exactly when result * result equals value.
- The result may have up to 500 digits.

## Input

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

## Output

- `result` (string, required)
- `is_perfect_square` (boolean, required)

## Limits

- max digits: 1000

## Example

Request input:

```json
{
  "value": "17"
}
```

Response:

```json
{
  "result": {
    "result": "4",
    "is_perfect_square": false
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "integer-sqrt",
  "version": "1.0.0",
  "input": {
    "value": "17"
  }
}
```

### HTTP (no key)

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

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

### CLI

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

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

## Related tools

- [Integer nth root](/tools/integer-nth-root): Compute the exact floor of the nth root of a non-negative integer string.
- [Integer digital root](/tools/integer-digital-root): Repeatedly sum the base-b digits of the magnitude of an integer string until a single digit remains.
- [Integer is perfect square](/tools/integer-is-perfect-square): Test whether a non-negative integer string is a perfect square.
- [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.
