HomeCalculatorsMathNumber Theory & Discrete MathPrime Factorization Calculator
Math calculator

Prime Factorization Calculator

Factor n = ∏ p^e and test primality for 1 ≤ n ≤ 10^12. Trial division. One capability, two modes.

Instant result
Result

Enter values to calculate.

Inputs
Mode
Formula
Trust summary Engine tested · Specification checked · 11/11 tests · Production surface contract 3/3 · v1.0.0
Input interpretation
Enter values to calculate.
Result
Model
Prime factorization and primality for integers 1 ≤ n ≤ 10^12.
Scope
Unique factorization (fundamental theorem of arithmetic)
Verification
Engine tested · 11/11 tests · Production surface contract 3/3 · Specification checked · v1.0.0
Named expert review
Optional · Not performed
Specification basis
  • ISO 80000-2:2019 Quantities and units — Mathematics (primes / factorization)
  • Fundamental theorem of arithmetic
Specification basis
Evidence
3 golden · 2 boundary · 6 property · Production surface contract 3/3 · Artifact integrity PASS
Production
Embedded snapshot: unpublished · Build schema 1.0.0 ready · Semantic contract ✓ · Attestation report not published on origin · Live production status PASS (0 stale; 164 CURRENT) @ 2026-09-16T06:44:24.909Z
Semantic contract
PASS

Formulas

Core equations used by this calculator.

Canonical formn = p₁^{e₁} × p₂^{e₂} × …
Primen is prime iff the factorization is n¹
iTrial division up to √n. Domain 1 ≤ n ≤ 10¹². Not a cryptographic primality prover.

How to use

1

Choose factorize or primality

Both modes return the same factorization object. is_prime is a view of that result.

2

Enter a positive integer n

1 ≤ n ≤ 10^12.

3

Read primes and exponents

ω is the number of distinct primes. Ω counts with multiplicity.

Example calculations

Common configurations with formula and result.

ϟ

12

Composite

12 = 2² × 3
2^2 × 3
ϟ

13

Prime

13
prime
ϟ

1

Empty factorization

1
neither prime nor composite

Prime Factorization calculator specification

Version 1.0.0 · Engine tested

Calculation status

Review policy · Evidence

Definition
Every integer n > 1 has a unique factorization into primes, up to order. n = 1 has no prime factors and is neither prime nor composite.
What it calculates
Prime factorization and primality for integers 1 ≤ n ≤ 10^12.
Inputs
  • mode?
  • n
Outputs
  • is_prime
  • factors
  • canonical
  • omega
  • big_omega
Formula
n = ∏ p_i^{e_i}
Assumptions
  • Unique factorization (fundamental theorem of arithmetic)
  • Trial division
  • n = 1 is neither prime nor composite
Units
  • dimensionless
Boundary conditions
  • missing n → MISSING_REQUIRED_INPUT
  • n < 1 → VALUE_MUST_BE_POSITIVE
  • n > 10^12 → VALUE_ABOVE_MAX
  • unknown mode → INVALID_MODE
Example
n=12 → 2^2 × 3
Validation cases

3 published on this page · 11/11 tests · Production surface contract 3/3 · View evidence

  • n=12 → 2^2 × 3
  • n=13 → prime
  • n=1 → canonical=1
Specification basis
  • ISO 80000-2:2019 Quantities and units — Mathematics (primes / factorization)
  • Fundamental theorem of arithmetic
Calculation version
1.0.0
}

Frequently asked questions

Key distinctions behind the calculation.

Is 1 prime?

No. 1 has an empty prime factorization and is neither prime nor composite.

Are factorization and primality two calculators?

No. One capability, two modes. Primality is whether the factorization is a single prime to the first power.

Where does this run?

Locally in the browser by default. REST and MCP call the same prime-factorization engine.