← Back to search

io.github.daedalus/mcp-number-theory

daedalus Scanned 19d ago

MCP server exposing number theory functions and factorization algorithms

B
88 / 100

Versions

0.1.0latest
first seen May 19, 2026
PermissionsTool SafetyAuthAnnotationsCode QualityStabilitySpecVuln HistoryAuthorTransparencyCommunity

Tools 88

is_primitive_root
annotations: none low

Check if g is a primitive root modulo p.

g int p int
gcd
annotations: none low

Compute the greatest common divisor of a and b.

a int b int
isqrt
annotations: none low

Compute the integer square root of n.

n int
introot
annotations: none low

Compute the integer r-th root of n. Returns None if not a perfect r-th power.

n int r int
invmod
annotations: none low

Compute the modular inverse of a modulo m.

a int m int
gcdext
annotations: none low

Compute the extended GCD of a and b. Returns a dict with g, x, y where g = gcd(a,b) and ax + by = g. Args: a: First integer b: Second integer Returns: Dict with keys 'g' (gcd), 'x', 'y' satisfying ax + by = g Example: >>> gcdext(48, 18) {'g': 6, 'x': -1, 'y': 3}

a int b int
is_square
annotations: none low

Check if n is a perfect square.

n int
is_cube
annotations: none low

Check if n is a perfect cube.

n int
next_prime
annotations: none low

Find the next prime after n.

n int
is_prime
annotations: none low

Test if n is prime using probabilistic methods.

n int
fib
annotations: none low

Compute the n-th Fibonacci number.

n int
primes
annotations: none low

Return a list of the first n primes.

n int
lcm
annotations: none low

Compute the least common multiple of x and y.

x int y int
invert
annotations: none low

Compute the modular inverse of a modulo b using Fermat's little theorem.

a int b int
powmod
annotations: none low

Compute b^e mod m using modular exponentiation.

b int e int m int
ilog2
annotations: none low

Compute the integer log base 2 of n.

n int
ilog
annotations: none low

Compute the integer log of n (natural log).

n int
ilog10
annotations: none low

Compute the integer log base 10 of n.

n int
phi
annotations: none low

Compute Euler's totient function phi(n) given the prime factors of n.

n int factors string
chinese_remainder
annotations: none low

Solve the Chinese Remainder Theorem. Given moduli m and remainders a, find x such that x ≡ a[i] (mod m[i]). The moduli must be pairwise coprime. Args: m: List of moduli (pairwise coprime) a: List of remainders Returns: The smallest non-negative solution x Example: >>> chinese_remainder([3, 5], [2, 3]) 8 # Since 8 ≡ 2 (mod 3) and 8 ≡ 3 (mod 5)

a string m string
legendre
annotations: none low

Compute the Legendre symbol (a/p).

a int p int
tonelli
annotations: none low

Compute the modular square root using Tonelli-Shanks algorithm. Returns x such that x^2 ≡ n (mod p).

n int p int
p_adic_valuation
annotations: none low

Return the exponent of the highest power of p dividing n.

n int p int
hensel_lift_square
annotations: none low

Lift quadratic residue from mod p to mod p^k using Hensel's method.

a int k int p int
hensel_lift_quadratic
annotations: none low

Lift root of ax^2 + bx + c ≡ 0 from mod p to mod p^k.

a int b int c int k int p int x0 int
lucas_lehmer
annotations: none low

Test if 2^p - 1 is a Mersenne prime using Lucas-Lehmer test.

p int
hensel_lift_cubic
annotations: none low

Lift root of ax^3 + bx^2 + cx + d ≡ 0 from mod p to mod p^k.

a int b int c int d int k int p int x0 int
dlp_bruteforce
annotations: none low

Solve discrete logarithm by brute force: find x such that g^x ≡ h (mod p).

g int h int p int
fac
annotations: none low

Compute the factorial of n.

n int
lucas
annotations: none low

Compute the n-th Lucas number.

n int
is_lucas
annotations: none low

Check if n is a Lucas number.

n int
find_period
annotations: none low

Find the period of n in binary representation.

n int
trivial_factorization_with_n_phi
annotations: none low

Factor n given phi(n). Returns (p, q) if found, None otherwise.

n int phi int
brent
annotations: none low

Factor n using Brent's algorithm (Pollard rho with optimizations). Returns a factor.

n int
carmichael
annotations: none low

Factor n using Carmichael's method. Returns list of factor pairs.

n int
fermat
annotations: none low

Factor n using Fermat's factorization method. Returns (p, q).

n int
pollard_rho
annotations: none low

Factor n using Pollard's rho algorithm. Returns a factor.

n int
pollard_P_1
annotations: none low

Factor n using Pollard's P-1 algorithm. Returns (p, q) if found.

n int
williams_pp1
annotations: none low

Factor n using Williams' P+1 algorithm. Returns (p, q) if found.

n int
shor
annotations: none low

Factor n using Shor's algorithm (classical part). Returns (p, q) if found.

n int
SQUFOF
annotations: none low

Factor n using Shanks' Square Forms Factorization. Returns (p, q) if found.

n int
hart
annotations: none low

Factor n using Hart's one-line factorization. Returns (p, q).

n int
kraitchik
annotations: none low

Factor n using Kraitchik factorization. Returns (p, q).

n int
lehman
annotations: none low

Factor n using Lehman's factorization algorithm. Returns (p, q) if found.

n int
euler_factorization
annotations: none low

Factor n using Euler's factorization method. Returns (p, q) if found.

n int
dixon
annotations: none low

Factor n using Dixon's factorization method. Returns (p, q) if found.

n int
wiener
annotations: none low

Attack RSA using Wiener's method given modulus n and public exponent e. Returns (p, q) if vulnerable.

e int n int
pollard_strassen
annotations: none low

Factor n using Pollard-Strassen algorithm. Returns (p, q) if found.

n int
factor_XYXZ
annotations: none low

Factor integer of form x^y * x^z. Returns (p, q) if found.

n int base int
factor_2PN
annotations: none low

Factor n where one factor is the prime P (p_val). Finds factors (p, q) such that n = p * q where p = p_val. Only works when n has p_val as one of its prime factors. Args: n: The integer to factor p_val: The prime factor to look for (default: 3) Returns: Tuple (p, q) where p = p_val and q = n/p, or "No factorization found" Example: >>> factor_2PN(15) (3, 5) >>> factor_2PN(14) 'No factorization found'

n int p_val int
lehmer_machine
annotations: none low

Factor n using Lehmer's machine (fermat-based). Returns (p, q).

n int
repunit_factor
annotations: none low

Factor n using repunit properties. Returns (p, q) if found.

n int
factor_high_and_low_bits_equal
annotations: none low

Factor when high and low bits are equal. Returns (p, q) if found.

n int max_middle_bits int
difference_of_powers_factor
annotations: none low

Factor using difference of powers method. Returns list of factors.

n int
getpubkeysz
annotations: none low

Get public key size in bits.

n int
neg_pow
annotations: none low

Calculate a^b mod n when b is negative.

a int b int n int
contfrac_to_rational
annotations: none low

Convert continued fraction to rational number.

frac string
powmod_base_list
annotations: none low

Compute powmod for a list of bases.

exp int mod int base_lst string
powmod_exp_list
annotations: none low

Compute powmod for a list of exponents.

mod int base int exp_lst string
close_factor
annotations: none low

Factor n using close factor algorithm. Returns (p, q) if found.

b int n int
inverseinversesqrt2exp
annotations: none low

Compute modular inverse square root approximation with k bits.

k int n int
jacobi
annotations: none low

Compute Jacobi symbol (a/n). Returns -1, 0, or 1.

a int n int
mobius
annotations: none low

Compute Möbius function. Returns 0 if n has squared prime factor.

n int
is_square_free
annotations: none low

Check if n is square-free.

n int
carmichael_lambda
annotations: none low

Compute Carmichael function (exponent of multiplicative group mod n).

n int
prime_factors
annotations: none low

Return list of distinct prime factors of n.

n int
divisors
annotations: none low

Return all positive divisors of n in ascending order.

n int
num_divisors
annotations: none low

Count number of positive divisors of n (tau function).

n int
sum_divisors
annotations: none low

Compute sum of all positive divisors of n (sigma function).

n int
aliquot_sum
annotations: none low

Compute sum of proper divisors (excluding n).

n int
is_sophie_germain
annotations: none low

Check if p is a Sophie Germain prime (p and 2p+1 are both prime).

p int
is_safe_prime
annotations: none low

Check if p is a safe prime (p = 2q + 1 where q is prime).

p int
prime_counting
annotations: none low

Count primes <= x.

x int
nth_prime
annotations: none low

Return the nth prime (1-indexed).

n int
is_prime_power
annotations: none low

Check if n = p^k for some prime p. Returns (p, k) if true.

n int
multiplicative_order
annotations: none low

Find multiplicative order of a modulo n.

a int n int
discrete_log
annotations: none low

Solve g^x ≡ h (mod p) using baby-step giant-step.

g int h int p int
kronecker_symbol
annotations: none low

Compute Kronecker symbol (a/n).

a int n int
best_rational_approximation
annotations: none low

Find best rational approximation to x with denominator <= max_denom.

x float max_denom int
primitive_root
annotations: none low

Find a primitive root modulo p. Returns None if p is not prime.

p int
solve_linear_diophantine
annotations: none low

Solve ax + by = c for integers x, y. Returns (x, y) or None if no solution.

a int b int c int
sum_of_two_squares
annotations: none low

Return (a, b) such that n = a^2 + b^2, or None if not representable.

n int
partition_function
annotations: none low

Compute partition function p(n) - number of ways to write n as sum of positive integers.

n int
is_smooth
annotations: none low

Check if n is B-smooth (all prime factors <= bound).

n int bound int
aks_primality
annotations: none low

Deterministic primality test using AKS algorithm.

n int
solve_pell
annotations: none low

Solve x^2 - D*y^2 = 1, returning fundamental solution (x, y).

D int
frobenius_number
annotations: none low

Compute Frobenius number for coprime coin denominations a, b.

a int b int
integer_relation
annotations: none low

Find integer relation between real numbers using PSLQ algorithm.

values string

Permissions 0

No permissions indexed yet.

Scan Findings 181

low
Tool 'gcd' has no annotations annotation_checker · 100%
low
Tool 'isqrt' has no annotations annotation_checker · 100%
low
Tool 'introot' has no annotations annotation_checker · 100%
low
Tool 'invmod' has no annotations annotation_checker · 100%
low
Tool 'gcdext' has no annotations annotation_checker · 100%
low
Tool 'is_square' has no annotations annotation_checker · 100%
low
Tool 'is_cube' has no annotations annotation_checker · 100%
low
Tool 'next_prime' has no annotations annotation_checker · 100%
low
Tool 'is_prime' has no annotations annotation_checker · 100%
low
Tool 'fib' has no annotations annotation_checker · 100%
low
Tool 'primes' has no annotations annotation_checker · 100%
low
Tool 'lcm' has no annotations annotation_checker · 100%
low
Tool 'invert' has no annotations annotation_checker · 100%
low
Tool 'powmod' has no annotations annotation_checker · 100%
low
Tool 'ilog2' has no annotations annotation_checker · 100%
low
Tool 'ilog' has no annotations annotation_checker · 100%
low
Tool 'ilog10' has no annotations annotation_checker · 100%
low
Tool 'phi' has no annotations annotation_checker · 100%
low
Tool 'chinese_remainder' has no annotations annotation_checker · 100%
low
Tool 'legendre' has no annotations annotation_checker · 100%
low
Tool 'tonelli' has no annotations annotation_checker · 100%
low
Tool 'p_adic_valuation' has no annotations annotation_checker · 100%
low
Tool 'hensel_lift_square' has no annotations annotation_checker · 100%
low
Tool 'hensel_lift_quadratic' has no annotations annotation_checker · 100%
low
Tool 'hensel_lift_cubic' has no annotations annotation_checker · 100%
low
Tool 'dlp_bruteforce' has no annotations annotation_checker · 100%
low
Tool 'fac' has no annotations annotation_checker · 100%
low
Tool 'lucas' has no annotations annotation_checker · 100%
low
Tool 'is_lucas' has no annotations annotation_checker · 100%
low
Tool 'find_period' has no annotations annotation_checker · 100%
low
Tool 'trivial_factorization_with_n_phi' has no annotations annotation_checker · 100%
low
Tool 'brent' has no annotations annotation_checker · 100%
low
Tool 'carmichael' has no annotations annotation_checker · 100%
low
Tool 'fermat' has no annotations annotation_checker · 100%
low
Tool 'pollard_rho' has no annotations annotation_checker · 100%
low
Tool 'pollard_P_1' has no annotations annotation_checker · 100%
low
Tool 'williams_pp1' has no annotations annotation_checker · 100%
low
Tool 'shor' has no annotations annotation_checker · 100%
low
Tool 'SQUFOF' has no annotations annotation_checker · 100%
low
Tool 'hart' has no annotations annotation_checker · 100%
low
Tool 'kraitchik' has no annotations annotation_checker · 100%
low
Tool 'lehman' has no annotations annotation_checker · 100%
low
Tool 'euler_factorization' has no annotations annotation_checker · 100%
low
Tool 'dixon' has no annotations annotation_checker · 100%
low
Tool 'wiener' has no annotations annotation_checker · 100%
low
Tool 'pollard_strassen' has no annotations annotation_checker · 100%
low
Tool 'factor_XYXZ' has no annotations annotation_checker · 100%
low
Tool 'factor_2PN' has no annotations annotation_checker · 100%
low
Tool 'lehmer_machine' has no annotations annotation_checker · 100%
low
Tool 'repunit_factor' has no annotations annotation_checker · 100%
low
Tool 'factor_high_and_low_bits_equal' has no annotations annotation_checker · 100%
low
Tool 'difference_of_powers_factor' has no annotations annotation_checker · 100%
low
Tool 'getpubkeysz' has no annotations annotation_checker · 100%
low
Tool 'neg_pow' has no annotations annotation_checker · 100%
low
Tool 'contfrac_to_rational' has no annotations annotation_checker · 100%
low
Tool 'powmod_base_list' has no annotations annotation_checker · 100%
low
Tool 'powmod_exp_list' has no annotations annotation_checker · 100%
low
Tool 'close_factor' has no annotations annotation_checker · 100%
low
Tool 'inverseinversesqrt2exp' has no annotations annotation_checker · 100%
low
Tool 'jacobi' has no annotations annotation_checker · 100%
low
Tool 'mobius' has no annotations annotation_checker · 100%
low
Tool 'is_square_free' has no annotations annotation_checker · 100%
low
Tool 'carmichael_lambda' has no annotations annotation_checker · 100%
low
Tool 'prime_factors' has no annotations annotation_checker · 100%
low
Tool 'divisors' has no annotations annotation_checker · 100%
low
Tool 'num_divisors' has no annotations annotation_checker · 100%
low
Tool 'sum_divisors' has no annotations annotation_checker · 100%
low
Tool 'aliquot_sum' has no annotations annotation_checker · 100%
low
Tool 'is_sophie_germain' has no annotations annotation_checker · 100%
low
Tool 'is_safe_prime' has no annotations annotation_checker · 100%
low
Tool 'prime_counting' has no annotations annotation_checker · 100%
low
Tool 'nth_prime' has no annotations annotation_checker · 100%
low
Tool 'is_prime_power' has no annotations annotation_checker · 100%
low
Tool 'multiplicative_order' has no annotations annotation_checker · 100%
low
Tool 'discrete_log' has no annotations annotation_checker · 100%
low
Tool 'kronecker_symbol' has no annotations annotation_checker · 100%
low
Tool 'best_rational_approximation' has no annotations annotation_checker · 100%
low
Tool 'primitive_root' has no annotations annotation_checker · 100%
low
Tool 'is_primitive_root' has no annotations annotation_checker · 100%
low
Tool 'lucas_lehmer' has no annotations annotation_checker · 100%
low
Tool 'solve_linear_diophantine' has no annotations annotation_checker · 100%
low
Tool 'sum_of_two_squares' has no annotations annotation_checker · 100%
low
Tool 'partition_function' has no annotations annotation_checker · 100%
low
Tool 'is_smooth' has no annotations annotation_checker · 100%
low
Tool 'aks_primality' has no annotations annotation_checker · 100%
low
Tool 'solve_pell' has no annotations annotation_checker · 100%
low
Tool 'frobenius_number' has no annotations annotation_checker · 100%
low
Tool 'integer_relation' has no annotations annotation_checker · 100%
info
Sandbox failed to start for behavioral verification behavioral_verifier · 100%
info
pyproject.toml metadata manifest_parser · 100%
info
Tool: gcd manifest_parser · 90%
info
Tool: isqrt manifest_parser · 90%
info
Tool: introot manifest_parser · 90%
info
Tool: invmod manifest_parser · 90%
info
Tool: gcdext manifest_parser · 90%
info
Tool: is_square manifest_parser · 90%
info
Tool: is_cube manifest_parser · 90%
info
Tool: next_prime manifest_parser · 90%
info
Tool: is_prime manifest_parser · 90%
info
Tool: fib manifest_parser · 90%
info
Tool: primes manifest_parser · 90%
info
Tool: lcm manifest_parser · 90%
info
Tool: invert manifest_parser · 90%
info
Tool: powmod manifest_parser · 90%
info
Tool: ilog2 manifest_parser · 90%
info
Tool: ilog manifest_parser · 90%
info
Tool: ilog10 manifest_parser · 90%
info
Tool: phi manifest_parser · 90%
info
Tool: chinese_remainder manifest_parser · 90%
info
Tool: legendre manifest_parser · 90%
info
Tool: tonelli manifest_parser · 90%
info
Tool: p_adic_valuation manifest_parser · 90%
info
Tool: hensel_lift_square manifest_parser · 90%
info
Tool: hensel_lift_quadratic manifest_parser · 90%
info
Tool: hensel_lift_cubic manifest_parser · 90%
info
Tool: dlp_bruteforce manifest_parser · 90%
info
Tool: fac manifest_parser · 90%
info
Tool: lucas manifest_parser · 90%
info
Tool: is_lucas manifest_parser · 90%
info
Tool: find_period manifest_parser · 90%
info
Tool: trivial_factorization_with_n_phi manifest_parser · 90%
info
Tool: brent manifest_parser · 90%
info
Tool: carmichael manifest_parser · 90%
info
Tool: fermat manifest_parser · 90%
info
Tool: pollard_rho manifest_parser · 90%
info
Tool: pollard_P_1 manifest_parser · 90%
info
Tool: williams_pp1 manifest_parser · 90%
info
Tool: shor manifest_parser · 90%
info
Tool: SQUFOF manifest_parser · 90%
info
Tool: hart manifest_parser · 90%
info
Tool: kraitchik manifest_parser · 90%
info
Tool: lehman manifest_parser · 90%
info
Tool: euler_factorization manifest_parser · 90%
info
Tool: dixon manifest_parser · 90%
info
Tool: wiener manifest_parser · 90%
info
Tool: pollard_strassen manifest_parser · 90%
info
Tool: factor_XYXZ manifest_parser · 90%
info
Tool: factor_2PN manifest_parser · 90%
info
Tool: lehmer_machine manifest_parser · 90%
info
Tool: repunit_factor manifest_parser · 90%
info
Tool: factor_high_and_low_bits_equal manifest_parser · 90%
info
Tool: difference_of_powers_factor manifest_parser · 90%
info
Tool: getpubkeysz manifest_parser · 90%
info
Tool: neg_pow manifest_parser · 90%
info
Tool: contfrac_to_rational manifest_parser · 90%
info
Tool: powmod_base_list manifest_parser · 90%
info
Tool: powmod_exp_list manifest_parser · 90%
info
Tool: close_factor manifest_parser · 90%
info
Tool: inverseinversesqrt2exp manifest_parser · 90%
info
Tool: jacobi manifest_parser · 90%
info
Tool: mobius manifest_parser · 90%
info
Tool: is_square_free manifest_parser · 90%
info
Tool: carmichael_lambda manifest_parser · 90%
info
Tool: prime_factors manifest_parser · 90%
info
Tool: divisors manifest_parser · 90%
info
Tool: num_divisors manifest_parser · 90%
info
Tool: sum_divisors manifest_parser · 90%
info
Tool: aliquot_sum manifest_parser · 90%
info
Tool: is_sophie_germain manifest_parser · 90%
info
Tool: is_safe_prime manifest_parser · 90%
info
Tool: prime_counting manifest_parser · 90%
info
Tool: nth_prime manifest_parser · 90%
info
Tool: is_prime_power manifest_parser · 90%
info
Tool: multiplicative_order manifest_parser · 90%
info
Tool: discrete_log manifest_parser · 90%
info
Tool: kronecker_symbol manifest_parser · 90%
info
Tool: best_rational_approximation manifest_parser · 90%
info
Tool: primitive_root manifest_parser · 90%
info
Tool: is_primitive_root manifest_parser · 90%
info
Tool: lucas_lehmer manifest_parser · 90%
info
Tool: solve_linear_diophantine manifest_parser · 90%
info
Tool: sum_of_two_squares manifest_parser · 90%
info
Tool: partition_function manifest_parser · 90%
info
Tool: is_smooth manifest_parser · 90%
info
Tool: aks_primality manifest_parser · 90%
info
Tool: solve_pell manifest_parser · 90%
info
Tool: frobenius_number manifest_parser · 90%
info
Tool: integer_relation manifest_parser · 90%
info
Sandbox failed to start for output poisoning scan output_poisoning · 100%
info
No dependency files found for SBOM generation sbom_generator · 100%
medium
No build provenance detected (SLSA L0) slsa_assessor · 90%