Est. 1985 Intermediate

PARI/GP

A specialized computer algebra system and scripting language for fast computations in number theory, built around an arbitrary-precision arithmetic engine.

Created by Henri Cohen and collaborators (Université Bordeaux)

Paradigm Procedural, Interactive; domain-specific (computer algebra / number theory)
Typing Dynamic, with a rich set of mathematical types
First Appeared 1985
Latest Version PARI/GP 2.17.3 (November 2025)

PARI/GP is a specialized computer algebra system designed from the ground up for fast computations in number theory: factorization, algebraic number theory, elliptic curves, modular forms, L-functions, and arbitrary-precision arithmetic on integers, real numbers, polynomials, and power series. Unlike general-purpose computer algebra systems that aim to cover symbolic mathematics broadly, PARI/GP is unapologetically focused on the needs of number theorists, and that focus has made it one of the most trusted tools in the field for more than four decades. The system pairs a high-performance C library with an interactive calculator and a lightweight scripting language, letting researchers move fluidly from quick experiments to large, long-running computations.

History & Origins

PARI/GP grew out of the number-theory community at the Université Bordeaux 1 (now part of the Université de Bordeaux) in France. Its conceptual ancestor was ISABELLE, an interpreter for higher arithmetic written in 1979 by Henri Cohen and François Dress. The PARI project itself was conceived in the early 1980s — François Dress is credited with proposing the name, which is generally described as a pun: it reportedly alludes both to the French pari (“wager,” echoing Pascal’s Wager) and to the “Pascal ARIthmetic” library the authors began writing in Pascal before the system was rewritten in C. (Official project notes also gloss the acronym in French as Projet d’Arithmétique Récursive et d’Interprétation.)

PARI first appeared around 1985, developed by a team led by Henri Cohen at the Laboratoire A2X in Bordeaux. To achieve the speed that serious number-theoretic computation demands, Christian Batut, Henri Cohen, and Michel Olivier wrote a hand-tuned assembly-language kernel in 1986. By 1987, Dominique Bernardi had built a calculator with convenient algebraic notation, which evolved into the interactive gp interface that most users encounter today.

The project’s stewardship passed to Karim Belabas in 1995, around the time of the final 1.x release, and he has remained the lead maintainer ever since, supported by a community of volunteer contributors. Under his guidance the 2.x series began in 1997, and in November 2000 version 2.1.0 became the first release distributed under the GNU General Public License, cementing PARI/GP’s status as free software.

Design Philosophy

PARI/GP is built around a single, uncompromising idea: number-theoretic computation should be fast. Where many systems prioritize symbolic generality or a polished general-purpose language, PARI/GP prioritizes raw arithmetic throughput and a rich vocabulary of number-theoretic operations.

  • Speed first: The arithmetic kernel was originally written partly in assembly language, and the library is engineered for performance on the operations number theorists actually use. Modern builds can also use the GNU MP (GMP) library for big-integer arithmetic.
  • Arbitrary precision by default: Integers, rationals, real numbers, and p-adic numbers can carry enormous precision — significands can run to millions of digits — without the user having to opt in to special “big number” types.
  • Mathematical types as first-class citizens: The system understands not just numbers but polynomials, power series, vectors, matrices, finite-field elements, number-field elements, and elliptic curves, with operations defined naturally across them.
  • Three faces, one engine: The same fast core is exposed as a library, an interactive calculator, and a scripting language, so the boundary between exploring an idea and programming a computation is deliberately thin.

This focus is also PARI/GP’s defining limitation: it is not intended to be a general-purpose programming language, and its scripting language is a means to drive mathematical computation rather than to build large software systems. Within its domain, however, that narrowness is precisely its strength.

The Three Components

A frequent source of confusion is that “PARI/GP” actually names a small family of closely related things:

ComponentWhat it is
PARIThe underlying C library, intended to be linked into other programs that need fast number-theoretic computation.
gpThe interactive command-line calculator that gives direct, immediate access to PARI’s functions.
GPThe scripting language understood by gp, used to write programs and automate computations.

In everyday practice, most users start at the gp prompt, typing expressions and getting answers immediately, then graduate to writing GP scripts as their computations grow more elaborate. Developers building larger applications link directly against the PARI library in C.

Key Features

Number Theory and Arithmetic

PARI/GP’s reason for being is its deep catalogue of number-theoretic functionality:

  • Integer factorization and primality testing
  • Algebraic number theory: number fields, ideals, class groups, units
  • Elliptic curves over various fields, including point counting and rank computations
  • Modular forms and L-functions
  • p-adic numbers and finite fields
  • High-precision evaluation of special functions and constants

The GP Scripting Language

GP offers a compact, readable syntax for driving these computations. A short example computing the factorial-like product and factoring an integer:

\\ Sum of the first 10 squares
sum(n = 1, 10, n^2)

\\ Factor a large integer
factor(2^67 - 1)

\\ Work with an elliptic curve y^2 = x^3 - x
E = ellinit([0, 0, 0, -1, 0]);
ellorder(E, [0, 0])

gp2c — Compiling Scripts

For performance-critical work, the gp2c (“GP-to-C”) compiler — first prototyped by Bill Allombert in late 2000 — translates GP scripts into C code that links against the PARI library. Compiled scripts can run substantially faster than interpreted ones; the project’s documentation has historically cited speedups on the order of several times for typical scripts, though the exact gain depends heavily on the computation.

Platform Support

According to the official distribution pages, PARI/GP is available across the major desktop platforms. Binary distributions are provided for Windows (32-bit and 64-bit) and macOS (including both Apple Silicon and Intel builds, in standard and multithreaded variants), and an Android build is distributed as PariDroid. On Linux and other Unix-like systems, PARI/GP is typically installed either from source or through distribution packages, which are available for Debian, Ubuntu, Fedora, and other distributions. There is no official Docker image, though community-maintained images exist on Docker Hub.

Evolution

The arc from the assembly kernel of the mid-1980s to the modern system reflects steady, careful evolution rather than dramatic reinvention. The 1.x series established the core engine and the gp calculator. The 2.x series, begun in 1997, brought a major modernization of the codebase and, with version 2.1.0 in 2000, the move to the GPL that opened the project to wider collaboration. Over the following decades the library accumulated ever more sophisticated functionality — modular forms, more powerful L-function machinery, improved number-field algorithms — while remaining backward-compatible enough that scripts written years earlier continue to run. The latest stable release, version 2.17.3, arrived in November 2025.

Current Relevance

PARI/GP remains actively developed and widely used in computational number theory. Its influence extends well beyond direct users: SageMath embeds PARI/GP as a core arithmetic component, reaching it from Python through the cypari2 interface, and the L-functions and Modular Forms Database (LMFDB) counts it among its standard computational tools. The GAP computer algebra system can call into PARI through the Alnuth package for algebraic number theory. Recognition has followed this longevity: the project received the ACM SIGSAM Richard D. Jenks Memorial Prize in 2021 for excellence in software engineering applied to computer algebra.

Why It Matters

PARI/GP is a case study in the power of doing one thing extremely well. By refusing to be a general-purpose system and instead obsessing over the speed and breadth of number-theoretic computation, it became indispensable infrastructure for an entire research community. Generations of theorems have been conjectured, tested, and explored with PARI/GP at the keyboard, and its arithmetic engine quietly powers parts of much larger systems that most users never realize depend on it. More than forty years after its first appearance, it endures as both a working tool and a reminder that depth, not breadth, is sometimes the surest path to lasting relevance.

Timeline

1979
Henri Cohen and Francois Dress write ISABELLE, an interpreter for higher arithmetic at Universite Bordeaux 1 and a conceptual precursor to PARI
1983
The project is conceived; Francois Dress proposes the name PARI, reportedly a pun on the French 'pari' ('wager') and the 'Pascal ARIthmetic' library of the system's early, Pascal-based stages
1985
PARI first appears, developed by a team led by Henri Cohen at the Laboratoire A2X, Universite Bordeaux 1, for fast number-theory computations
1986
The first PARI assembly-language kernel is written by Christian Batut, Henri Cohen, and Michel Olivier for high-performance arithmetic
1987
Dominique Bernardi develops a calculator with algebraic notation, giving rise to the interactive 'gp' interface
1995
pari-1.39, the final 1.x release, ships in January; Karim Belabas becomes the lead maintainer of the project
1997
pari-2.0.alpha is released, beginning the long-lived 2.x series
2000
pari-2.1.0 is released in November as the first version distributed under the GNU General Public License; Bill Allombert builds the first gp2c (GP-to-C compiler) prototype in December
2021
The PARI/GP project is awarded the ACM SIGSAM Richard D. Jenks Memorial Prize for excellence in software engineering applied to computer algebra
2025
pari-2.17.3 is released in November as the latest stable version

Notable Uses & Legacy

SageMath

The open-source mathematics system SageMath embeds PARI/GP as a core component for number-theoretic computation, accessed from Python through the cypari2 interface

LMFDB

The L-functions and Modular Forms Database, a large collaborative research resource in computational number theory, relies on PARI/GP among its standard computational packages

Computational number theory research

Mathematicians use PARI/GP for integer factorization, elliptic curves, modular forms, L-functions, and algebraic number theory, often as the workhorse behind published results

GAP (via Alnuth)

The computational algebra system GAP interfaces with PARI through the Alnuth package to perform algebraic number theory calculations

OpenDreamKit

The EU Horizon 2020 OpenDreamKit project supported PARI/GP development and workshops as part of building an open virtual research environment for mathematics

Language Influence

Influenced By

Pascal C ISABELLE

Influenced

SageMath cypari2

Running Today

Run examples using the official Docker image:

docker pull
Last updated: