ArticleslgStudy

computer science

Prime95

Prime95 is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Prime95 rather than just read about it. In short: Prime95, also distributed as the command-line utility mprime for FreeBSD, Linux, and MacOS is a freeware application written by George Woltman. It is the official client of the Great Internet Mersenne Prime Search (GIMPS), a volunteer computing project dedicated to searching for Mersenne primes.

Prime95 — main illustration
Prime95 — illustration

Key takeaways

  • Prime95 belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Prime95 to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Prime95 from memory before moving on to harder problems.

Reference excerpt

Prime95, also distributed as the command-line utility mprime for FreeBSD, Linux, and MacOS is a freeware application written by George Woltman. It is the official client of the Great Internet Mersenne Prime Search (GIMPS), a volunteer computing project dedicated to searching for Mersenne primes. It is also used in overclocking to test for system stability. Although most of its source code is available, Prime95 is not free and open-source software because its end-user license agreement states that if the software is used to find a prime qualifying for a bounty offered by the Electronic Frontier Foundation, then that bounty will be claimed and distributed by GIMPS.

Finding Mersenne primes by volunteer computing Prime95 tests numbers for primality using the Fermat primality test (referred to internally as PRP, or "probable prime"). For much of its history, it used the Lucas–Lehmer primality test, but the availability of Lucas–Lehmer assignments was deprecated in April 2021 to increase search throughput. Specifically, to guard against faulty results, every Lucas–Lehmer test had to be performed twice in its entirety, while Fermat tests can be verified in a small fraction of their original run time using a proof generated during the test by Prime95. Current versions of Prime95 remain capable of Lucas–Lehmer testing for the purpose of double-checking existing Lucas–Lehmer results, and for fully verifying "probably prime" Fermat test results (which, unlike "prime" Lucas–Lehmer results, are not conclusive). To reduce the number of full-length primality tests needed, Prime95 first checks numbers for trivial compositeness by attempting to find a small factor. As of 2024, test candidates are mainly filtered using Pollard's p − 1 algorithm. Trial division is implemented, but Prime95 is rarely used for that work in practice because it can be done much more efficiently using a GPU, due to the type of arithmetic involved. Finally, the elliptic-curve factorization method and Williams's p + 1 algorithm are implemented, but are considered not useful at modern GIMPS testing levels and mostly used in attempts to factor much smaller Mersenne numbers that have already undergone primality testing. GIMPS has discovered 18 new Mersenne primes since its foundation in 1996, the first 17 of which using Prime95. The 18th and most recent, M136279841, was discovered in October 2024 using an Nvidia GPU, being the first GIMPS discovery to not have used Prime95 and its CPU computation. 15 of the 17 primes discovered with Prime95 were the largest known prime number at the time of their respective discoveries, the exceptions being M37156667 and M42643801, which were discovered out of order from the larger M43112609.

gwnum gwnum is the code for most mathematical operations in Prime95. It is written in hand-tuned assembly code for a number of microarchitectures. For large number modular multiplication it implements the irrational base discrete weighted transform in double precision, exploiting the oversized (compared to integer operations) floating-point capacity of x86 CPUs. It also implements polynomial multiplication for use in P-1 and ECM Stage 2. gwnum is also used by other distributed computing projects such as PrimeGrid's PRST.

Use for stress testing

To maximize search throughput, most of Prime95's math library (gwnum) is written in hand-tuned assembly, which makes its system resource usage much greater than most other computer programs. Additionally, due to the high precision requirements of primality testing, the program is very sensitive to computation errors and proactively reports them. These factors make it a commonly used tool among overclockers to check the stability of a particular configuration. Prime95 has a built-in "torture test" (formerly "Self-Test") feature for this purpose. In this mode, it checks the results of stress testing against known-good results that comes with the program. As a result, any miscalculation is definitively spotted. The "small" and "medium" FFT modes have a memory access pattern that fits into the CPU's cache, making them ideal for placing maximal stress on the CPU cores. The "large" FFT mode needs to frequently access the RAM. As a result, it produces less stress on the CPU but is able to test the memory controller as well as the memory modules. There is also a "blend" mode that mixes these modes.

See also List of volunteer computing projects Stress testing Prime number PrimeGrid

References

External links Official website with downloads for various architectures How to use Prime95 for stress (torture) testing

Worked examples

Example 1 — a first encounter with Prime95

Start with the simplest possible case. Write down what Prime95 claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Prime95 before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Prime95 ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Prime95

In research
Prime95 appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Prime95 in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Prime95 is common in secondary-school and first-year university syllabi. It links to neighbouring topics BSD software, Benchmarks (computing), Great Internet Mersenne Prime Search, so understanding it makes those chapters shorter.
In everyday life
Look for Prime95 outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Prime95 in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Prime95 means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Prime95 out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Prime95 in simple terms?

Prime95, also distributed as the command-line utility mprime for FreeBSD, Linux, and MacOS is a freeware application written by George Woltman. It is the official client of the Great Internet Mersenne Prime Search (GIMPS), a volunteer computing project dedicated to searching for Mersenne primes.

Why does Prime95 matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Prime95?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Prime95.

Tags

  • BSD software
  • Benchmarks (computing)
  • Great Internet Mersenne Prime Search
  • Mathematical software
  • Primality tests
  • Science software for Linux
  • Science software for Windows
  • Science software for macOS
  • Volunteer computing projects

Keep exploring