number_theory_operation
Perform primality testing, integer factorization, next prime, gcd, and lcm on large integers. Pass values above 2^53 as strings to avoid precision errors.
Instructions
Number theory: primality testing, integer factorisation, the next prime above n, gcd and lcm. Prefer this over evaluate_sage for any of these.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | Primary integer. Pass values above 2^53 as a decimal STRING: JSON numbers are IEEE doubles in JavaScript-based clients, so 10^30 arrives as 1000000000000000019884624838656 and the answer is silently wrong. | |
| b | No | Second integer, required for gcd and lcm. Same string rule. | |
| session | No | Workspace to use, as a name or a portable handle. Workspaces have independent variables. A name is scoped to this MCP session; a handle returned by start_sage_session (workspace_token) reaches the same workspace across reconnects and is a bearer credential -- keep it secret. Omit for 'default'. | default |
| operation | Yes | Operation: 'is_prime', 'factor_integer', 'next_prime', 'gcd', 'lcm' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||