Skip to content

Trial Division

Test a complete, carrier-bounded cover of candidate divisors by exact division to find a factor or rule out reducibility.

Version
v2 · 2026-11-14 · History
Domain-specific #
13675
Domain group
Formal Sciences
Origin domain
Mathematics
Subdomains
Number Theory, Computational Algebra → Mathematics

Core Idea

Trial division tests candidate proper divisors by exact division. A factor found is a witness that the target is reducible; if a complete bounded candidate set is exhausted without a factor, the target is prime or irreducible under the declared algebraic setting. Finding the first factor is not yet the same as finding every factor.[1][2]

How would you explain it like I'm…

Try Every Small Divider

To check if a number can be split into equal groups, you try dividing it by 2, then 3, then 4, and so on. If one of them divides it evenly, you've found a factor. You only need to try small numbers up to a certain point, because any bigger partner would have a smaller partner you already checked.

Checking Divisors One by One

Trial division is a way to find out whether a number has any factors besides 1 and itself. You try dividing by 2, then 3, then 4, and keep going, checking if any divide exactly with no remainder. You only need to go up to the square root of the number, because if a number is two factors multiplied together, at least one of them is that small. If nothing divides it, the number is prime. Finding one factor doesn't finish the job of breaking it into all its prime factors, though; you'd have to keep going with what's left.

Bounded Exact-Divisor Search

Trial division looks for a factor of a number by testing candidate divisors one at a time with exact division. For a whole number n greater than 1, if n is composite, it equals a × b where at least one of a or b is at most √n. So it is enough to test every integer from 2 up to √n, or just the primes in that range. If one divides evenly, you have found a factor; if none do, n is prime. Finding a factor is not the same as the full prime factorization, and if you divide it out and keep going, the square-root limit applies to the new, smaller number. The same idea works for polynomials over a finite field, where you only need to test monic polynomials up to half the degree.

 

Trial division is bounded exact-divisor search: test candidate divisors in turn, where the candidate set must cover every possible smaller member of a nontrivial factor pair. A success yields a divisor; exhausting the set supports a primality or irreducibility conclusion under the declared carrier and bound. For an integer n > 1, a composite n = ab has a factor in (1, floor(sqrt n)], so testing all integers in that range, or only the primes if prime generation is correct, suffices. Returning one factor is not a complete factorization; if a found factor is divided out and the search continues, the square-root bound applies to the current residual, not the original n. Over F_p[T], a polynomial of degree d >= 2 that factors nontrivially has a nonconstant factor of degree at most floor(d/2), so testing all nonconstant monic polynomials up to that degree finds a divisor or proves irreducibility, with monic normalization avoiding redundant scalar multiples. The integer square-root cutoff and the polynomial half-degree cutoff are domain-specific realizations of the same bounded search.

Scope of Application

For a positive integer \(n>1\), test candidates through \(\lfloor\sqrt n\rfloor\): a composite integer has a factor no larger than that. For \(f\in\mathbb F_p[T]\) of degree \(d\ge2\), Keith Conrad's polynomial version tests nonconstant monic candidates through degree \(\lfloor d/2\rfloor\). The square-root and half-degree cutoffs do the same structural job but are not interchangeable formulas. Units, zero and degree-one polynomials require separate boundary treatment.[1][2]

Clarity

Choose the target, its nonunit divisor class, a complete candidate cover and an exact zero-remainder test. Testing primes only is an integer optimization; testing all eligible integers also works. Over \(\mathbb F_p[T]\), monic representatives prevent duplicate tests of scalar associates. An early search that finds nothing says only “none among those tried”; the prime/irreducible conclusion requires the full carrier-specific bound.[1][2]

Manages Complexity

The factor-pair theorem converts a seemingly unlimited divisibility question into finitely many verifiable trials. It also identifies where the method may become costly: candidate count grows with integer magnitude or polynomial degree and field size. Optimized enumeration saves tests only when it preserves coverage, and a handoff to a different algorithm is optional rather than part of trial division's identity.[1][2]

Abstract Reasoning

For $1001\(, tests by \$2,3,5\) fail and $7$ divides, leaving $143\(; continuing on the residual finds \$11\) and $13$. The first hit proves compositeness, whereas \(1001=7\cdot11\cdot13\) is the later complete result. For \(f=T^4+T^2+1\) over \(\mathbb F_2[T]\), the degree-two monic candidate \(g=T^2+T+1\) divides because \(f=g^2\) in characteristic two. The polynomial candidate falls within \(\lfloor4/2\rfloor=2\), not an integer square-root bound.[1][2]

Knowledge Transfer

The same method travels literally from integers to finite-field polynomials: bounded adequate candidates, exact divisibility, factor witness or exhaustive no-factor certificate. Its carrier-specific units and bounds must be rederived. Live Algorithm is the proposed strict parent; live Factorization and Integer Factorization concern decomposition outcomes or a narrower target, not this cross-carrier method.

Relationships to Other Abstractions

Local relationship map for Trial DivisionParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Trial DivisionDOMAINPrime abstraction: Algorithm — is a kind ofAlgorithmPRIME

Current abstraction Trial Division Domain-specific

Parents (1) — outgoing typed relations

  • Trial Division is a kind of Algorithm Prime

    Trial division is a finite exact-search algorithm over bounded proper-divisor candidates.

Hierarchy path (1) — routes to 1 parentless root

Neighborhood in Abstraction Space

Trial Division sits in a moderately populated region (51st percentile for distinctiveness): it has near-neighbors but no dense thicket of look-alikes.

Family — Number-Theoretic Properties & Tests (22 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

References

[1] Number Theory: In Context, §12.5.2 “Trial division” and Algorithm 12.5.7, original textbook author text (2017 edition). registry ↩a ↩b ↩c ↩d ↩e

[2] Keith Conrad, “Irreducibility Tests in \(\mathbb F_p[T]\)”, original author notes, §2 Theorem 2.1 and Example 2.2, PDF p.1. registry ↩a ↩b ↩c ↩d ↩e