Integer is prime
integer-is-prime · version 1.0.0 · Numbers & math · free, no key needed
Deterministically test whether a non-negative integer string is prime.
Use when you need to: integer is prime · primality test · check if a number is prime.
Decide before calling
Read the versioned contract and the supported scope below. Reuse integer-is-prime@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use integer-is-prime@1.0.0 for integer is prime. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- integer is prime
- primality test
- check if a number is prime
Not supported
- negative primality
- probabilistic primality
- prime factorization
Behavior
- value is a canonical non-negative integer string: 0 or a non-zero leading digit followed by digits, at most 24 digits.
- Negative values are rejected; primality is only defined here for non-negative integers.
- 0 and 1 are not prime; the result is false for both.
- Primality is decided by deterministic Miller-Rabin with witnesses {2,3,5,7,11,13,17,19,23,29,31,37}, which is proven exact for every value below 3317044064679887385961981 (~3.3e24); the 24-digit input cap keeps every accepted value inside that proven range.
- The result is a JSON boolean, never probabilistic.
Input
value(string, required): max length 24; pattern^(0|[1-9][0-9]*)$
Output
is_prime(boolean, required)
Limits
- max digits: 24
Example
Request input:
{
"value": "997"
}
Response:
{
"result": {
"is_prime": true
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "integer-is-prime",
"version": "1.0.0",
"input": {
"value": "997"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/integer-is-prime/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"value":"997"}'
The machine-readable contract is at /v1/tools/integer-is-prime/versions/1.0.0.
CLI
node cli.mjs run integer-is-prime 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Integer is perfect square: Test whether a non-negative integer string is a perfect square.
- Chi square decomposition check: Check a claimed Pearson chi-square, its per-cell (O-E)^2/E terms and df exactly; returns the first wrong term.
- Chromatic certificate check: Check a claim chi(G) = k: a proper k-colouring plus a clique or bounded exhaustive proof; returns the first discrepancy.
- Network flow feasibility check: Check a claimed s-t flow for capacity bounds and conservation with exact integers; returns the first bad edge or node.
- Bipartite coloring check: Check a complete 0/1 coloring witness for graph bipartiteness and report the first certificate discrepancy.
- Coloring count check: Check a proper indexed coloring and an exact canonical-decimal claim for its number of distinct colors.