Prime factorization with step-by-step trial division

Enter an integer n (|n| ≥ 2) to see every division step, τ(n), σ(n), φ(n), and an automatically drawn factor tree. Supply an optional integer m to compare exponents and derive gcd and lcm.

Other languages: ja | en | zh-CN | es

Inputs

Integers are parsed exactly (BigInt). Use a second integer to compare exponents for gcd/lcm.

Digits with an optional leading minus sign. |n| must be at least 2.

If supplied, the tool factors m, builds an exponent table, and shows gcd(n, m) and lcm(n, m).

Result summary

Factor tree

For education only. Trial division up to 6k ± 1 is fast for classroom-sized integers (≈10¹³).

FAQ

What integers can this tool factor?

Enter any integer with |n| ≥ 2. Very large values are supported, but the division steps may take longer to finish.

How is the factor tree drawn?

Each composite node splits by its smallest prime factor until every leaf is prime. The tree updates automatically after each calculation.

Related calculators