encyclopegia.org

Trial division

Trial division is the most laborious but easiest to understand of the integer factorization algorithms.[src] The essential idea behind trial division tests to see if an integer , the integer to be factored, can be divided by each number in turn that is less than or equal to the square root of .[src] For example, to find the prime factors of , one can try to divide by successive primes: first, ; next, neither nor evenly divides ; finally, , and is itself prime.[src] So .[src] Trial division was first described by Fibonacci in his book Liber Abaci (1202).[src]

Trial division is the most laborious but easiest to understand of the integer factorization algorithms.[src] The essential idea behind trial division tests to see if an integer , the integer to be factored, can be divided by each number in turn that is less than or equal to the square root of .[src] For example, to find the prime factors of , one can try to divide by successive primes: first, ; next, neither nor evenly divides ; finally, , and is itself prime.[src] So .[src] Trial division was first described by Fibonacci in his book Liber Abaci (1202).[src] A definite bound on the prime factors is possible.[src] Suppose is the 'th prime, so that P 1 = 2, P 2 = 3, P 3 = 5, etc.[src] Then the last prime number worth testing as a possible factor of n is where ; equality here would mean that is a factor.[src] Thus, testing with 2, 3, and 5 suffices up to n = 48 not just 25 because the square of the next prime is 49, and below n = 25 just 2 and 3 are sufficient.[src] Should the square root of n be an integer, then it is a factor and n is a perfect square.[src] The trial division algorithm in pseudocode: algorithm trial-division is input: Integer n to be factored output: List F of prime factors of n P ← set of all primes ≤ F ← empty list of factors for each prime p in P do while n mod p is 0 Add factor p to list F n ← n/p if F is empty (Original n is prime?) Add factor n to list F Determining the primes less than or equal to is not a trivial task as n gets larger, so the simplest computer programs to factor a number just try successive integers, prime and composite, from 2 to as possible factors.[src] ==Speed== In the worst case, trial division is a laborious algorithm.[src] For a base-2 n digit number a, if it starts from two and works up only to the square root of a, the algorithm requires \pi(2^{n/2}) \approx {2^{n/2} \over \left(\frac{n}{2}\right) \ln 2} trial divisions, where \pi(x) denotes the prime-counting function, the number of primes less than x.[src] This does not take into account the overhead of primality testing to obtain the prime numbers as candidate factors.[src] A useful table need not be large: P(3512) = 32749, the last prime that fits into a sixteen-bit signed integer and P(6542) = 65521 for unsigned sixteen-bit integers.[src] That would suffice to test primality for numbers up to 65537 2 = 4,295,098,369.[src] Preparing such a table (usually via the Sieve of Eratosthenes) would only be worthwhile if many numbers were to be tested.[src] If instead a variant is used without primality testing, but simply dividing by every odd number less than the square root the base-2 n digit number a, prime or not, it can take up to about: 2^{n/2} In both cases, the required time grows exponentially with the digits of the number.[src] Even so, this is a quite satisfactory method, considering that even the best-known algorithms have exponential time growth.[src] For a chosen uniformly at random from integers of a given length, there is a 50% chance that 2 is a factor of a and a 33% chance that 3 is a factor of a, and so on.[src] It can be shown that 88% of all positive integers have a factor under 100 and that 92% have a factor under 1000.[src] Thus, when confronted by an arbitrary large a, it is worthwhile to check for divisibility by the small primes, since for a = 1000 , in base-2 n=10 .[src] However, many-digit numbers that do not have factors in the small primes can require days or months to factor with trial division.[src] In such cases other methods are used such as the quadratic sieve and the general number field sieve (GNFS).[src] Because these methods also have superpolynomial time growth a practical limit of n digits is reached very quickly.[src] For this reason, in public key cryptography, values for a are chosen to have large prime factors of similar size so that they cannot be factored by any publicly known method in a useful time period on any available computer system or computer cluster such as supercomputers and computer grids.[src] The largest cryptography-grade number that has been factored is RSA-260, a 260-digit number, factored in September 2026 using a GPU-accelerated implementation of the general number field sieve.[src] ==References==[src]

33 sentences · 33 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Trial division." encyclopegia.org, 2026, https://encyclopegia.org/wiki/trial-division. Accessed 02 December 2026.

Chicago

"Trial division." encyclopegia.org. Accessed December 2, 2026. https://encyclopegia.org/wiki/trial-division.

APA

encyclopegia.org. (2026). Trial division. Retrieved December 2, 2026, from https://encyclopegia.org/wiki/trial-division

Accessed December 2, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Agra division

stub · references available

1999–2000 Moldovan National Division

stub · references available

2013 Norwegian First Division

stub · references available

35th Division

stub · references available

1992–93 Argentine Primera División

stub · references available

2nd SS Panzer Division Das Reich

stub · references available

1966 Norwegian First Division

stub · references available

1971 Norwegian First Division

stub · references available
CC BY-SA 4.0 · tier1-factual · https://en.wikipedia.org/w/index.php?oldid=1374099257 · 0.55 · snapshot trial-division-155121-919a39fb16d88948 · QID Q1333681

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.