Array integer adjacent diff
array-integer-adjacent-diff · version 1.0.0 · Numbers & math · free, no key needed
Replace an array of canonical integer strings with consecutive first differences.
Use when you need to: array integer adjacent diff · consecutive integer differences · first differences of integer array.
Supported
- array integer adjacent diff
- consecutive integer differences
- first differences of integer array
Not supported
- second differences
- percentage change
- floating point differences
- derivative of a function
- CSV column differences
Behavior
- Input values is an array of at most 10000 canonical integer strings.
- A canonical integer is 0 or an optional ASCII minus followed by a non-zero leading digit and only digits after that.
- Input -0 is accepted and canonicalized to 0; +, spaces, underscores, hex, exponents, empty strings, and other leading zeros are rejected.
- Integers are parsed with BigInt. IEEE-754 numbers are rejected.
- Output values has length n-1; item i is values[i+1] minus values[i] as a canonical integer string.
- Arrays of length 0 or 1 yield an empty array.
- Each input and every difference may have at most 1000 digits excluding the sign.
Input
values(array of string, required): max items 10000; each min length 1; each max length 1001
Output
values(array of string, required): max items 9999; each max length 1001; each pattern^(0|-?[1-9][0-9]*)$
Limits
- max items: 10000
- max digits: 1000
Example
Request input:
{
"values": [
"4",
"-1",
"7",
"0"
]
}
Response:
{
"result": {
"values": [
"-5",
"8",
"-7"
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "array-integer-adjacent-diff",
"version": "1.0.0",
"input": {
"values": [
"4",
"-1",
"7",
"0"
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/array-integer-adjacent-diff/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"values":["4","-1","7","0"]}'
The machine-readable contract is at /v1/tools/array-integer-adjacent-diff/versions/1.0.0.
CLI
node cli.mjs run array-integer-adjacent-diff 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Array integer cumulative sum: Replace an array of canonical integer strings with equal-length prefix sums.
- Array integer GCD: Compute the non-negative greatest common divisor of an array of canonical integer strings.
- Array integer LCM: Compute the non-negative least common multiple of an array of canonical integer strings.
- Array integer median: Select lower and upper middle canonical integers; emit median only for odd length.
- 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.