Advanced maths

Gaussian integer prime factorization calculator

Factor a nonzero Gaussian integer into Gaussian primes and a remaining unit, with exact reconstruction.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Factor a nonzero Gaussian integer into Gaussian primes and a remaining unit, with exact reconstruction. The result shows how ordinary rational primes split or remain prime in the Gaussian integers. Associate choices and unit factors are explicit, so mathematically equivalent factorizations need not have identical signs or ordering.

THE FORMULAa+bi=unit × product of Gaussian primes.

A worked example

The Gaussian integer 5 factors as (1+2i)(1−2i). Associated prime factors may differ by units, so the returned unit must be included when reconstructing the original integer. Each displayed factor has norm 5, while their product has norm 25.

Good to know

Components≤100,000, exact integer norm and reconstruction; one associate convention. Zero rejected, units have no prime factors.

Work in the Gaussian integer ring

A Gaussian integer is a+bi with integer a and b. Its units are one, minus one, i and minus i, and its norm is a squared plus b squared. Norms multiply, giving a useful bridge between a Gaussian factorization and ordinary positive-integer factorization.

A nonzero unit has no prime factors and is returned entirely as the unit. Zero has no finite prime factorization and is rejected. Decimal or rational components would describe a different domain, so the form requires bounded integers rather than rounding them into Gaussian integers.

A rational prime can split into two Gaussian prime factors1+2i1−2i(1+2i)(1−2i)=5Norms: 5 and 5Product norm: 25
The Gaussian integer 5 factors as (1+2i)(1−2i). Associated prime factors may differ by units, so the returned unit must be included when reconstructing the original integer. Each displayed factor has norm 5, while their product has norm 25. Diagram is schematic; labels specify the numerical values.

The Gaussian integer GCD calculator with steps applies Euclidean division to two Gaussian integers. Prime factorization here decomposes one nonzero element and verifies its factors together with the remaining unit.

Distinguish the three rational-prime behaviors

The rational prime two ramifies: it is a unit times (one plus i) squared. A rational prime congruent to one modulo four splits into two conjugate Gaussian prime factors. A rational prime congruent to three modulo four remains Gaussian prime when viewed on the real axis.

These cases explain why factoring the norm alone is not already a full Gaussian factorization. A norm prime factor can correspond to a conjugate split, a repeated ramified factor or a real Gaussian prime. The implementation follows those cases and tests exact divisibility of the current Gaussian remainder.

Check the factorization of five

Five equals (one plus two i) times (one minus two i). Each factor has norm five, and their product has norm twenty-five, matching the norm of five plus zero i. Another convention can use two plus i and its associates with a compensating unit.

The unit is part of the answer. Omitting it can turn an otherwise plausible list of associated primes into the wrong original value. Check the full product, not merely the product of factor norms, because norms discard complex signs and orientation.

Use exact Gaussian division

To divide a current value by candidate c+di, multiply by its conjugate and divide both resulting integer components by c squared plus d squared. The candidate divides exactly only when both numerators are divisible by that norm. No floating-point rounding is needed for this membership test.

Every successful division removes one factor and retains it with multiplicity. The remaining value is processed until its norm is one. This is different from the Euclidean GCD tool, which seeks a common divisor of two inputs rather than a complete prime factorization of one input.

Interpret associates and conjugates

Multiplying a Gaussian prime by any unit gives an associate, which represents the same prime factor up to units. A canonical-looking factorization therefore requires a convention for moving units among factors. The page returns one reproducible convention but does not claim that its exact text is the only correct factor list.

Conjugating the original value conjugates its factorization, with unit adjustments as needed. Conjugate split factors can occur with different multiplicities in a general nonreal input. Their norms can match even though the Gaussian primes themselves are not associates, so norm counts alone do not retain the full factorization.

Verify completeness with the remaining unit

At the end, the leftover Gaussian integer must have norm one. A larger leftover norm would mean the prime-factor extraction was incomplete and triggers an error. The solver also multiplies the unit and every listed factor and checks that both real and imaginary components match the original exactly.

Those checks certify reconstruction and completion under the implemented rational-prime cases. They do not identify a unique factor ordering or make a differently normalized factorization invalid. Compare products and associate classes when auditing another program’s output.

Keep bounds and domain conclusions separate

Components are limited to absolute value one hundred thousand, keeping ordinary norm factorization and splitting searches bounded for an educational page. This is not a claim of a fast arbitrary-size Gaussian factorization algorithm. Much larger components can require specialized number-theory software.

The factorization occurs in Z[i], not in every quadratic integer ring. Unique-factorization behavior and rational-prime splitting can differ in other rings, so the same rules cannot be copied to a+bsqrt of another negative integer without checking the domain. Retain the ring and unit convention with the result.

A few questions, answered

Why does the result include a unit?

Associates differ by factors ±1 or ±i. The remaining unit is needed to reconstruct the exact original value.

Does factoring the norm alone give the factorization?

No. It guides the prime cases, but exact Gaussian divisibility determines the factors and multiplicities.

Can a real rational prime remain Gaussian prime?

Yes. Rational primes congruent to three modulo four remain prime in Z[i].

Why is zero rejected?

It has no finite Gaussian prime factorization. Units, in contrast, are valid and have an empty factor list.

Find your calculator

Start typing to explore the library.