Array integer GCD
array-integer-gcd · version 1.0.0 · Numbers & math · free, no key needed
Compute the non-negative greatest common divisor of an array of canonical integer strings.
Use when you need to: array integer gcd · gcd of an array of integers · greatest common divisor of a list.
Supported
- array integer gcd
- gcd of an array of integers
- greatest common divisor of a list
- n-ary gcd
Not supported
- least common multiple
- gcd of two integers
- floating-point gcd
Behavior
- Input values is an array of canonical base-10 integer strings with at least 1 and at most 10000 items.
- The input -0 is accepted per item and canonicalized to 0 before evaluation.
- The gcd is computed pairwise left to right and is independent of order.
- A single value returns its absolute value.
- gcd of an all-zero array is undefined and rejected, matching the two-argument gcd(0, 0) convention.
- The result is the non-negative greatest common divisor as a canonical integer string.
Input
values(array of string, required): min items 1; max items 10000; each max length 1001; each pattern^-?(0|[1-9][0-9]*)$
Output
value(string, required)
Limits
- max items: 10000
- max digits: 1000
Example
Request input:
{
"values": [
"48",
"18",
"30"
]
}
Response:
{
"result": {
"value": "6"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "array-integer-gcd",
"version": "1.0.0",
"input": {
"values": [
"48",
"18",
"30"
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/array-integer-gcd/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"values":["48","18","30"]}'
The machine-readable contract is at /v1/tools/array-integer-gcd/versions/1.0.0.
CLI
node cli.mjs run array-integer-gcd 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Array integer LCM: Compute the non-negative least common multiple of an array of canonical integer strings.
- Integer GCD: Compute the non-negative greatest common divisor of two canonical integer strings.
- Array integer median: Select lower and upper middle canonical integers; emit median only for odd length.
- Array rational sum: Sum an array of canonical rationals and return the reduced total.
- Array integer min max: Return the numeric minimum and maximum of canonical integer strings.
- Array integer mode: Return the most frequent canonical integers, listing every mode in first-seen order.