Category 9 — Cryptography / Security

Number Theory Calculator

Compute GCD, LCM, Euler's totient, coprime check, and prime factorization for two integers.

How to use this tool

  1. Enter two positive integers in the Number A and Number B fields — results update automatically as you type.
  2. Read the Shared Properties grid for GCD(A, B), LCM(A, B), the coprime answer (Yes/No), and their product.
  3. Look under Number A and Number B for each value's φ(n) (Euler's totient) and prime factorization.
  4. Tap a sample button — 84 & 18, 100 & 25, or 65537 & 17 — to load a preset pair instantly.
  5. Both fields must hold positive integers; otherwise the status line shows Enter two positive integers or Numbers must be positive.

Why this tool is helpful

Reduce fractions & common denominators

The GCD divides numerator and denominator to lowest terms, while the LCM finds a shared denominator or a common time interval.

Verify coprime keys for RSA

In RSA the public exponent e must be coprime to φ(n). The coprime check confirms gcd = 1 before you commit to parameters.

Compute Euler's totient φ(n)

Used across cryptography and number theory — for primes p and q, φ(p·q) = (p−1)(q−1). This tool returns it directly for each input.

Factor integers on the fly

Prime factorization underpins the hardness of RSA and many proofs. See each number broken into its prime-power form (2^2 × 3 × 7).

Trust arbitrary-precision results

All math runs on JavaScript BigInt, so huge values stay exact instead of silently rounding like floating point would.

Stay private

Everything computes locally in your browser. Nothing is uploaded, logged, or sent to a server — safe for working with key material.

FAQ

What does this calculator compute?

For two integers it returns their GCD, LCM, whether they are coprime, and their product, plus φ(n) (Euler's totient) and the prime factorization of each number.

What is the GCD, and how is it used?

The greatest common divisor is the largest integer that divides both numbers evenly. It's computed with the Euclidean algorithm and is the basis for reducing fractions to lowest terms.

What is Euler's totient φ(n)?

φ(n) counts the positive integers up to n that are coprime to n. For example φ(9) = 6. It's central to RSA key generation and modular arithmetic.

What does "coprime" mean?

Two numbers are coprime when their only common divisor is 1 — that is, gcd(A, B) = 1. It doesn't require either number to be prime.

Can it handle very large integers?

Yes. Computations use JavaScript BigInt, so there's no floating-point rounding — the results stay exact even for large values.

Why does it say "Numbers must be positive" or "Enter two positive integers"?

The tool only accepts positive integers. Empty fields, negative numbers, decimals, fractions, or non-digit characters are rejected and the results area is hidden until valid input is entered.

Does any of my input leave my browser?

Never. All number-theory calculations happen locally in JavaScript. Your values are not sent to, stored on, or logged by any server.