The concept of factorization, properly defined, usually excludes "units", that is, numbers with an inverse. So 1 is a unit, since we can solve

1x = 1

by letting x = 1. -1 is a unit too, since (-1)x = 1 is also solvable.

Factorization is then defined "upto units and reordering", so, for instance,

6 = 2 * 3 = (-2) * (-3) = 3 * 2 = (-3) * (-2)

are all considered the same factorization.

Why might this be useful? Sometimes, number systems ("rings") we care about might have more units, and in order for there to be a sensible theory of factorization[1], we have to take these things into account. Not all rings are as nice as Z[2].

For instance, allow me to go off on a tangent: consider the set of all numbers of the form

a + ib (a, b integers)

called the Gaussian integers (written Z[i]). One can show that the units here are 1, -1, and also two new ones: i and -i. Studying factorization in this ring -- what numbers can we factorize further now? -- is very interesting. It turns out that not all of our usual prime numbers "remain prime":

2 = 1 + 1 = 1 - i^2 = (1 + i)^2
3 = 3
5 = 1 + 4 = 1 - (2i)^2 = (1 + 2i)(1 - 2i)
7 = 7
11 = 11
13 = 4 + 9 = 4 - (3i)^2 = (2 + 3i)(2 - 3i)
...

The key to this puzzle is to notice that the primes that "split"[3] all leave a remainder of 1 modulo 4. It is a beautiful fact that the converse also holds: if

p = 1 (mod 4)

then it must factor in Z[i], and, further, it always factors as

p = (a + ib)(a - ib) = a^2 + b^2

(And, of course, if we have p = a^2 + b^2, it can be factored just like we did above.) In other words,

Theorem[4] (Fermat, sometimes called the "Christmas theorem").
The primes that can be written as a sum of two squares are exactly those congruent to 1 mod 4.

Neither the question (which primes can be written as a sum of two squares) nor the answer (those congruent to 1 mod 4) involve any of the machinery we used in getting from one to the other. :)

PS. Yes, I may or may not have ignored the case of 2 above. Tons of theorems in number theory are stated for "odd primes". 2 is, after all, the oddest prime.

--

[1]: e.g. it turns out that "p is prime", defined as

p | ab implies p | a or p | b

and "p is irreducible" (i.e. not factorizable in any sensible way), defined as

p = ab implies either a or b is a unit

are not equivalent! One direction always holds, but the other doesn't come for free.

https://en.wikipedia.org/wiki/Prime_element

[2]: Each step up the ladder of class inclusions adds some nice property that makes life easier, but diminishes the power of the theorems one proves. (Euclidean domains are almost perfect in that sense!) Behold, a bestiary most vile:

https://en.wikipedia.org/wiki/Euclidean_domain

[3]: Notice that 2 factorizes as a power, not as a product of distinct factors. This is technically "ramification", not "splitting" (that term is reserved for the distinct-factors case). The following Wikipedia page treats the entire content of this post far better, and has links to the "real" algebraic number theory pages ;)

https://en.wikipedia.org/wiki/Splitting_of_prime_ideals_in_G...

The numbers that don't factorize at all are said to remain "inert". (And there's something related called an "inertia group" that disappointingly has little to do with mechanics.)

[4]: https://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_...