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


From Prime-Wiki
Jump to: navigation, search
Workload type LL
First release April 2000
Latest version 2.9.0

Glucas is a program to perform the Lucas-Lehmer test for primality on Mersenne numbers. It is related to GIMPS effort to search the largest primes ever found. It was written in C by Guillermo Ballester Valor and Klaus Kastents.

Glucas uses a library YEAFFT (Yet Another FFT) to do convolutions (big multiplications). It is a Fast Fourier transform (FFT) package based on Richard Crandall's paper "Integer convolution via split-radix fast Galois transform" (1999). The multiplications algorithm also uses Discrete Weighted Transform described in the paper "Discrete weighted transforms and large-integer arithmetic" (1994) by R. Crandall and B. Fagin. The library is coded in C with some assembler macros for the gcc compiler.

Unlike Pime95, which was built for x86 architecture, Glucas could run on x86 (Pentium I/II/III, Athlon), Alpha (Alpha 21264), PowerPC (G3/G4) and Intel Itanium architectures. [1]

According to the documentation, as of June 2002, Glucas performed at about 80% speed of George Woltman's Prime95 v.20. Since then, however, Prime95 was massively optimized for SSE2, AVX, AVX2, AVX512 and FMA3 instruction sets, and, as of April 2018, it outperforms Glucas on a machine with AVX2 instructions by a factor of 5.

Glucas was used to verify M41, M43, M46 and M47 primes at the times of their discovery.

It is distributed under GPL license.

Running Glucas


Compiling Glucas from source (Linux assumed):


To customize Glucas behavior, you can edit file glucas.ini.

Integrity check

After building Glucas, it's advised to run the selftest:

./Glucas -s all

Passing all 31 tests will take a few minutes on a modern desktop x86 CPU.


The program can be run by placing exponents into file glucas.que. For example, to test M35, this line should be added:


After launching ./Glucas executable it will save text output to file glucas.out occasionally saving checkpoints to file t<EXPONENT> (in this case t1398269).

Alternatively, exponent can be provided as a command line parameter:

./Glucas 1398269

There must be no file with the name 1398269 however.