Topics Register • News • History • How to • Sequences statistics • Template prototypes


From Prime-Wiki
Jump to: navigation, search

Mfaktc is a GPU based Mersenne number factoring program. Taking advantage of the many cores available on modern graphics cards, this is a very fast program. The name mfaktc is "Mersenne number faktoring with CUDA", it is a mixture of English with the German for the word factoring (the author is German). mfaktc uses some CPU power to do some sieving and does the trial factoring work on the GPU. Starting with mfaktc 0.20 it is possible to run entirely on GPU with a very low demand for CPU resources. However GPU sieving is not supported on compute capability 1.x GPUs in 0.20. Mfaktc 0.21 can do GPU sieving for those old GPUs.

Hardware requirements

  • A CUDA capable GPU with compute capability 1.1 (or newer), any Geforce 8000, 9000, 200, 400, 500 series except those which are built around the G80 chip (Geforce 8800 GTS 320, 8800 GTS 640, 8800 GTX, and 8800 Ultra and their Quadro and Tesla variants) should work. (The next version will require CC 2.0 or newer.)
  • The CPU code is written in C and should work on several CPU architectures, however CUDA is only supported on x86 and x86_64 class CPU.

Software requirements

  • Linux or Windows, 32 or 64 bit versions. 64bit is prefered because mfaktc runs significantly faster in 64bit mode.
    • executables: CUDA >= 4.2 capable driver (295 series or newer)
    • source code: Any CUDA version >= 3.0 should work, it may work on 2.x versions. (The next version will require CUDA 6.5 or newer.)
      • There is a bug in CUDA toolkit 7.0 and 7.5, start reading here, just avoid this versions.

Current limits

  • Prime exponents between 100000 and [math]\displaystyle{ 2^{32}-1 }[/math]
  • Factor sizes [math]\displaystyle{ \lt 2^{95} }[/math] and value k [math]\displaystyle{ \lt 2^{63.9} }[/math]


The initial idea about Trial factoring with CUDA came about very early in 2007 right after the GTX 8800 and CUDA was released. No code was written, just collecting some ideas on paper. Based on false assumptions about CUDA, any further work on the project was stopped at that time.

At the end of 2009 it was decided to try TF on a GPU using CUDA. When coding was started the goal was a proof-of-concept (and the author was using it to learn the basics of CUDA programming). It is written in C and CUDA-C by Oliver Weihe (TheJudger on PrimeNet and MersenneForum), development is done on a Linux system. A few months later kjaget and amphoria, from the Mersenneforum, helped with Windows compatibility. Luigi Morelli (ET_) provided the first version of code for Prime95 worktodo.txt parsing (mfaktc 0.07 to mfaktc 0.14).

Early 2013 mfaktc 0.20 was released, this is the first version which features GPU sieving. This code was written by George Woltman.

In February 2015 mfaktc 0.21 was released, this version added support for trial factoring on Wagstaff numbers.


The program is released under the GNU/GPLv3 license.


Official website: (None)

Current version (0.21) on MersenneForum (

Previous version (0.20) on MersenneForum (

Contacting the author: PM on MersenneForum is preferred, email (see the sourcecode) is possible, too.


  • require CUDA 6.5 or newer (get rid of compatibility stuff in code)
  • drop support for compute capability 1.x GPUs
    • remove the "71bit" kernel, only choosen on 1.x GPUs

See also

  • mfakto (OpenCL port of mfaktc)

External links