Math and geometry

Prime factorization calculator

Decompose a positive integer into prime building blocks. Repeated factors remain visible so their exponents can be understood.

Enter your values

Your results

Prime factors
—

How we got this result: The page substitutes your current entries into this rule: Trial division repeatedly removes the smallest possible prime factor until the remaining value is 1.

How to use this calculator

  1. Enter integer.
  2. Review the assumptions and units shown beside the fields.
  3. Read the live result, calculation note, and worked examples before using the answer.

Cracking a Code That Uses 360 as a Key

Imagine you inherit a lock with a dial set to 360. The manual says the key is hidden inside the number itself. You cannot just guess digits. You need the true structure. Prime factorization is your tool here. It strips away the composite layers until only the fundamental pieces remain. You are not looking for a random sequence. You are hunting for the specific primes that multiply together to form 360.

Start with the smallest prime, which is 2. Divide 360 by 2 and you get 180. Divide again to get 90. One more time and you hold 45. Now 2 no longer works. Move to the next prime, 3. Divide 45 by 3 to get 15. Divide 15 by 3 to get 5. The number 5 is prime itself. Stop. You now have the full list: 2, 2, 2, 3, 3, and 5. This sequence is the unique fingerprint of 360. No other combination of primes produces this number.

This process proves the system is sound. If you were verifying a code, you would check if the entered factors match this exact set. Any deviation means the key is wrong. The repeated 2s and 3s are not errors. They are exponents waiting to be counted. By seeing them clearly, you understand the weight of each prime in the total. The lock opens only when the math is perfect.

The Building Block Idea Behind Every Whole Number

Think of every whole number as a unique recipe. Prime factorization breaks that recipe down into its simplest ingredients. You can write these primes in any order, but you cannot change which primes appear or how many times without changing the number itself. This structure is rigid and specific. It is the atomic core of integer arithmetic.

Take 360 as your example. It splits cleanly into 2 × 2 × 2 × 3 × 3 × 5. Those three twos, two threes, and one five are the only pieces that make up 360. No other combination of primes produces that exact total. The process is straightforward. You peel away the smallest prime factor until nothing is left but 1. The repeated factors stay visible. This lets you see the exponent clearly without doing extra mental math.

Some numbers resist this breakdown because they are already prime. 97 is one such case. It has no smaller divisors. Its only factor is itself. This highlights the boundary of the system. You can decompose composites, but primes stand alone. Even 1 fits the logic, though it yields an empty list. It is neither prime nor composite. Understanding this distinction keeps your calculations precise and your logic sound.

Trial Division: The Step-by-Step Process

The implementation starts with divisor 2 and keeps dividing while that divisor fits evenly. When it no longer fits, the code increments the candidate by one, so it tests 3, 4, 5, and so on rather than generating a separate list of primes. Composite candidates cannot appear in the output after their smaller prime factors have already been removed, which is why the recorded factors are still prime.

Consider the number 360. It is divisible by 2, so you divide to get 180. That is still even, so you divide again to reach 90, and once more to hit 45. Now 2 no longer works. You shift to 3. Since 45 divides evenly by 3, you get 15. Another pass with 3 gives you 5. At this point, 2 and 3 fail, but 5 divides 5 to leave 1. The algorithm halts immediately because the target is reached. You have extracted the full set of prime factors, 2, 2, 2, 3, 3, and 5. No remainder is left over.

This implementation handles edge cases directly. For 97, candidates 2 through 96 fail and 97 divides the remainder to 1, so the output is [97]. For input 1, the loop never starts and the returned list is empty, consistent with 1 having no prime factors.

Reading the Output: 2 × 2 × 2 × 3 × 3 × 5

For 360, the output is 2 × 2 × 2 × 3 × 3 × 5. Repeated factors become exponents, so the same factorization is 2³ × 3² × 5. Multiplying the list back together verifies it: 8 × 9 × 5 = 360. The ordered list is also convenient for comparing common factors with another integer; keep duplicates because their multiplicity matters.

Why 97 and 1 Behave Differently

For 97, the function finds no divisor from 2 through 96. When the candidate reaches 97, it divides once and leaves 1, producing the single-factor list [97]. That result means the input is prime: it has no positive divisors other than 1 and itself.

Now consider 1. This number breaks the usual pattern. It is neither prime nor composite. It has no prime factors at all. The algorithm starts looking for a divisor. It cannot find one because 1 is the identity element in multiplication. There is nothing to divide. The result is an empty list. This might look like an error to some. It is actually a precise mathematical truth. You cannot decompose 1 into primes because it is not made of them.

These edge cases define the boundaries of the system. 97 shows you a single, indivisible unit. 1 shows you the absence of units. Both outcomes are correct. They simply reflect different places in the number line. Your calculator handles them without special coding tricks. It just follows the rules of arithmetic. The result tells you exactly what you have.

Confusing Multiplication with Addition

You might see the list 2, 2, 2, 3, 3, 5 and instinctively add them up. If you do, you get 17. That number has nothing to do with the original value. Prime factorization is about multiplication, not addition. The entire point of breaking a number apart is to show how its parts combine to build it back. Adding the pieces destroys the relationship. You are looking at ingredients, not a grocery bill total.

Think of it this way. When you decompose 360, you are asking what multiplies together to create that specific number. The answer is 2 times 2 times 2 times 3 times 3 times 5. If you sum those digits instead, you lose the multiplicative structure entirely. The number 17 is just a random integer in this context. It does not reveal anything about the composition of 360. This is a common slip because our brains are wired to count items in a list. But here, the list represents a chain of operations, not a collection of independent values.

Keep the multiplication sign in mind every time you read the output. The repeated factors, like the three 2s, show how many times that prime divides the whole. Their contribution grows exponentially as you multiply them, not linearly as you add them. Confusing these two operations leads to a fundamental misunderstanding of number structure. You want to see how small primes stack up to form large numbers. Addition cannot do that. Multiplication is the only operation that respects the hierarchy of prime building blocks.

Prime Factorization vs. Divisibility Tests

Divisibility tests are quick checks. They tell you if a number like 360 splits evenly by 2 or 3. That is all. They do not show the full breakdown. A prime factorization calculator goes deeper. It digs until no further splitting is possible. You get the complete list of prime building blocks. This distinction matters when you need to understand the structure of a number, not just its surface traits.

For 97, a divisibility test by 2 or 3 alone is not enough to establish primality. The factorization routine continues through successive candidate divisors and returns [97] only after none of the smaller candidates divides it. A single divisibility test asks a narrow yes-or-no question; the complete factor list answers the broader structural question.

When you see 360, a divisibility test says it is even. It is also divisible by 3. That is useful. But it hides the fact that 360 contains three 2s, two 3s, and one 5. The calculator reveals this hidden architecture. You stop guessing about what divides the number. You start seeing exactly what makes it up. This clarity prevents errors in algebra and number theory. It turns a vague property into a precise set of components.

A Quick Guide to Prime, Composite, and 1

You need three definitions to make sense of any output. A prime number has exactly two positive divisors: one and itself. Ninety-seven is prime, so its factor list contains only 97. By contrast, 970 is composite and factors as 2 × 5 × 97.

A composite number is different. It has divisors other than one and itself. Three hundred and sixty falls into this category. You can split it into smaller parts. The process reveals 2, 2, 2, 3, 3, and 5. These are its prime building blocks. If you see a list with multiple entries, you are looking at a composite number. The length of the list tells you how many prime factors it has, counting repetitions.

Then there is the number one. It is neither prime nor composite. It has only one divisor: itself. When you input 1, the calculator returns an empty list. There are no prime factors to show. This is not an error. It is a specific mathematical state. Knowing these three categories helps you interpret the results. You will know immediately if a number is prime, composite, or the special case of one. The output matches the definition.

Reference and example table

CaseMeaning
Example 1360 factors as 2 × 2 × 2 × 3 × 3 × 5.
Example 297 is prime, so its only prime factor is 97.
Example 31 returns an empty factor list because 1 is neither prime nor composite.

Frequently asked questions

What is the prime factorization of 360?

The number 360 breaks down into 2 × 2 × 2 × 3 × 3 × 5. You can see that 2 appears three times and 3 appears twice, while 5 shows up once.

Is 97 a prime number?

Yes, 97 is prime. Its only prime factor is 97 itself because it has no other divisors.

What happens if I enter 1?

Entering 1 returns an empty list of factors. This is because 1 is neither prime nor composite.

How does the calculator find the factors?

It uses trial division to repeatedly remove the smallest possible prime factor. It keeps going until the remaining value is 1.

Why do I see repeated numbers in the output?

Repeated factors stay visible so you can understand their exponents. For instance, 360 shows three 2s to highlight the power of 2.

Can I use this for negative numbers?

No, the tool is designed to decompose positive integers only. You should enter a whole number greater than zero.

What does the output look like?

You get a list of prime factors. For example, 360 outputs the sequence 2, 2, 2, 3, 3, and 5.