b2KIT

Prime Factorization Tree

Build animated factor trees for any integer. Shows unique prime factorization, GCD, LCM, and divisor count.

Tested tool guide Tested browser tools Checked August 16, 2026

What Prime Factorization Tree does, with a checked example

Type any integer and this tool grows a factor tree, splitting each composite node into a pair of factors until every leaf is prime, with each division animated as it happens. It then reports the unique prime factorization with exponents, the divisor count, and, for two numbers, the GCD and LCM derived from those exponents. The usual surprise: the tree you see is only one possible drawing. 360 can split first as 2 x 180 or as 18 x 20, and both are correct; only the multiset of prime leaves is unique.

Worked example

A concrete input and expected output from the current implementation.

Input

360

Expected output

Animated tree: 360 -> 2 x 180 -> 2 x 90 -> 2 x 45 -> 3 x 15 -> 3 x 5. Unique prime factorization: 2^3 x 3^2 x 5. Divisor count: (3+1)(2+1)(1+1) = 24.

Each split divides the current value by its smallest prime factor: 360 halves three times, then divides by 3 twice, leaving 5. Grouping the six prime leaves by exponent gives 2^3 x 3^2 x 5, and the divisor count multiplies each exponent plus one: 4 x 3 x 2 = 24.

How the result is produced

1

Tree construction and animation

Every composite node splits into two factors whose product is the node's value, and the tool recurses on both children until a primality check stops the branch at a prime leaf. The animation plays the divisions in sequence, and the same number can yield different-looking trees depending on the first split. The leaves, collected and grouped by exponent, feed everything else the tool reports.

2

Factorization and derived quantities

From the leaves the tool writes n as the product of p_i^e_i, with repeated primes grouped into exponents. The divisor count is the product of (e_i + 1) over all primes. For two numbers, the GCD takes the smaller exponent of each shared prime and the LCM the larger; the identity GCD x LCM = a x b always holds, which is a quick way to check the pair of answers.

Good uses

  • Verifying a hand-drawn homework factor tree: enter the same number and watch the animation to find the mis-split branch, such as stopping at 45 instead of breaking it into 3 x 3 x 5.
  • Finding a common denominator without listing multiples: factor both denominators and read off the LCM, so 1/72 + 1/48 can use 144 as denominator.
  • Counting even divisions of a quantity: the divisor count tells you how many whole-number factor pairs exist, so 360, with 24 divisors, has 12 pairings of rows and columns for equal-size arrangements.

Limits and checks

  • Edge values have no factorization: 1 is the empty product with no prime factors, 0 is divisible by every integer, and negatives need a sign convention. Expect a message for these, not a tree.
  • Big inputs can stall: any factoring method must test divisors up to the square root of the remaining value, so a large semiprime (two big primes multiplied) can take a long time, and inputs beyond the page's limit are rejected.
  • Read the leaves, not the drawing: different split orders give different-looking trees for the same number, and if a branch stops early, a composite 'leaf' such as 9 or 15 makes the factorization and the divisor count wrong.

Common questions

My tree splits differently from the one in my textbook - which is right?

Both, as long as every leaf is prime. The fundamental theorem of arithmetic guarantees the multiset of prime factors is unique; only the intermediate branch choices differ. Splitting 360 as 2 x 180 or as 18 x 20 ends at the same leaves, 2, 2, 2, 3, 3, 5, so the factorization 2^3 x 3^2 x 5 is identical either way.

How do I tell whether my number is prime, and can the tool handle huge inputs?

A prime input never splits: the tree stays a single node and the divisor count comes out as 2, which is how you read primality from the result. How large an input the page accepts varies, and factoring slows as the largest prime factor grows, so very large numbers, especially semiprimes, can take a while or exceed the tool's limit.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools