FLINT is a C library which implements data structures and algorithms for the computational solution of problems in number theory.

FLINT can represent and compute with arbitrarily large integers and rational values. It can investigate problems over the set of integers modulo some base n. It can work with p-adic numbers. It can work in finite fields, whether of prime or nonprime order.

Some common number theoretic tasks it can investigate efficiently include generating or counting all primes less than N, using the Chinese Remainder Theorem, determining the number of partitions of an integer, setting up the Stirling matrices, factoring very large integers, computing greatest common divisors, testing for primality, operations on polynomials. FLINT is written in a thread-safe manner.

The FLINT web site is http://www.flintlib.org/


  1. William Hart, Fredrik Johansson, Sebastian Pancratz,
    FLINT, Fast Library for Number Theory,
    Documentation for Version 2.5.2.
  2. William Hart,
    Fast Library for Number Theory, an Introduction,
    Third International Conference on Mathematical Software: ICMS 2010,
    edited by K. Fukuda, J. van den Hoeven, M Joswig, N Takayama,
    Springer, 2010, pages 88-91.


Version 2.5.2 of FLINT is available on the ARC clusters DragonsTooth and NewRiver. To check the latest information on available versions on any ARC cluster, type “module spider flint”.


FLINT requires that several modules be loaded before it can be run. A sample set of commands for NewRiver might be:

module purge
module load gcc/5.2.0
module load flint/2.5.2


Here is an example batch script to run a problem:

#! /bin/bash
#PBS -l walltime=00:05:00
#PBS -l nodes=1:ppn=1
#PBS -W group_list=newriver
#PBS -q open_q
#PBS -j oe


module purge
module load gcc/5.2.0
module load flint/2.5.2

gcc -c -I$FLINT_INC primegen.c
gcc -o primegen primegen.o -L$FLINT_LIB -lflint
./primegen -c 1000000

A complete set of files to carry out a similar example calculation are available in a tar file