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:
{
"value": "17"
}
Response:
{
"result": {
"result": "4",
"is_perfect_square": false
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "integer-sqrt",
"version": "1.0.0",
"input": {
"value": "17"
}
}
HTTP (no key)
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.
CLI
node cli.mjs run integer-sqrt 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Integer nth root: Compute the exact floor of the nth root of a non-negative integer string.
- 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: Test whether a non-negative integer string is a perfect square.
- Array integer adjacent diff: Replace an array of canonical integer strings with consecutive first differences.
- Array integer clamp: Clamp an array of canonical integer strings to optional inclusive min and max bounds.
- Array integer cumulative sum: Replace an array of canonical integer strings with equal-length prefix sums.