math_prime_number_checker
Test an integer for primality, get its prime factorization (for composites up to 10^12), list primes in a range, or find the next/previous prime. Deterministic algorithms up to 2^64.
Instructions
Prime Number Checker, Factorizer, and Range Sieve. Test whether an integer is prime, list every prime within a numeric range, or find the next/previous prime relative to a number. The check operation reports primality plus a human-readable reason, the prime factorization (for composites up to 10^12), the surrounding primes, and which algorithm ran (trial division for n up to 10^12, deterministic Miller-Rabin up to 2^64). Use this for primality, factorization, and prime enumeration; use math_gcd_lcm_calculator for greatest common divisor / least common multiple, math_factorial_calculator for n! / nPr / nCr, and math_fibonacci_generator for Fibonacci sequences. Pure computation: deterministic, read-only, non-destructive, contacts no external service, and rate-limited (60 requests/minute for anonymous callers). Pass integers above 2^53 as numeric strings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | Which computation to run: check tests one integer (needs n); listPrimes enumerates primes between from and to; nextPrevPrime finds the adjacent prime to n in a given direction. | |
| n | No | Target integer for check and nextPrevPrime. Must be a non-negative base-10 integer; pass values above 2^53 as a numeric string. Hard upper bound 2^64. | |
| from | No | Inclusive lower bound for listPrimes. Non-negative integer. | |
| to | No | Inclusive upper bound for listPrimes. Non-negative integer; must be at least from, at most 10^8, and span (to minus from) at most 100000. | |
| direction | No | Required for nextPrevPrime: next finds the smallest prime greater than n, prev the largest prime less than n (null if none exists). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the operation succeeded. | |
| result | No | Operation-specific payload. | |
| error | No | Present only on failure; the validation message. |