# Category:PARI/GP

**PARI/GP**

This

**programming language**may be used to instruct a computer to perform a task.

Official website |
---|

Execution method: | Interpreted or compiled |
---|---|

Garbage collected: | Yes |

Parameter passing methods: | By reference, By value |

Type strength: | Weak |

Type checking: | Dynamic |

Lang tag(s): | parigp, c |

See Also: |

**Your Help Needed**

If you know

**PARI/GP**, please write code for some of the tasks not implemented in

**PARI/GP**.

PARI/GP is a widely used computer algebra system designed for fast computations in number theory (factorizations, algebraic number theory, elliptic curves...), but also contains a large number of other useful functions to compute with mathematical entities such as matrices, polynomials, power series, algebraic numbers etc., and a lot of transcendental functions.

PARI/GP is composed of two parts: a C library called PARI and an interface, gp, to this library. GP scripts are concise, easy to write, and resemble mathematical language. (Terminology: the scripting language of gp is called GP.)

PARI was written by Henri Cohen and others at Université de Bordeaux and is now maintained by Karim Belabas. gp was originally written by Dominique Bernardi, then maintained and enhanced by Karim Belabas and Ilya Zakharevich, and finally rewritten by Bill Allombert.

## Contents

## Using PARI/GP[edit]

PARI/GP can be downloaded at its official website's download page.

Windows precompiled binaries are available: an installer, stand-alone stable and development versions, plus a nightly build with the very latest changes. Mac snapshots are also available. Linux users can install PARI/GP with their favorite package manager (RPM, dpkg, apt, etc.) or build it from source. Instructions are available for compiling.

Android phones and tablets can use paridroid (also on github).

While an iPhone/iPad version has not been developed, sage-math includes gp. Click the "+" in the top-right to start a new program, then click and hold on "Sage" at the top until the "Select Language" dropdown appears, then choose GP. (You can also use the wrapper function `pari`

in a Sage snippet.)

Finally, gp can be used online through the PARI/GP site (via Emscripten), compile online or the SageMath cloud (see How to use PARI/GP in the SageMathCloud).

## Coding with PARI[edit]

The most common way to use PARI is through the gp calculator, using its own scripting language, GP. But there are other interfaces to PARI beside gp:

- PariGP on EmacsWiki, PariEmacs
- Pari-tty
- pariGUIde
- vim-notebook (see also the author's video on using gp from vim)
- Jupyter kernel

If you want to program with PARI, many languages are supported:

- C: PARI is written in C, so it's very easy to either write your own programs or extend gp using C. The gp2c utility converts GP scripts into executable C code.
- For use with the Gnu Mpc library, there is also Pari-Gnump.

- C++: PARI can be used directly in C++. The code is intentionally written in a C++-compatible style.
`-fpermissive`

is sometimes useful when compiling with g++. - Python:
- SageMath (or SAGE) is a Python-based system that includes GP among others
- pari-python
- cypari is a fork of the GP component of SageMath

- Perl:
- Common Lisp: Use Pari (CLISP).
- Mathematica: A quick tutorial using MathLink is available.

## See also[edit]

## Resources[edit]

### General[edit]

- PARI/GP FAQ
- Ateliers PARI/GP: Conference slides and other resources
- Comparison with Magma, GAP, and Singular

### Tutorials[edit]

- Official tutorial by The PARI Group (52 pp., 2014)
- Tutorial on Elliptic Curves by Bill Allombert and Karim Belabas (5 pp., 2016)
- Beginning PARI Programming for CSE/MATH 467 by W. Dale Brownawell (7 pp., 2014)
- Tutorial by Robert B. Ash (20 pp., 2007)
- Tutorial by Siman Wong (6 pp., 2009)
- Introduction by Keith Conrad (7 pp., 2008)
- The Pari Package On Linux, by Klaus-Peter Nischke (3 pp., 1995)
- PARI/GP programming for basic cryptography by Minh Van Nguyen (appx. 3 pp., 2008); also appears in an extended version (9 pp., 2008)
- Exploring binary numbers with PARI/GP calculator by Rick Regan (appx. 4 pp., 2009)
- Video tutorials, parts 1 2 3 4 (appx. 20 minutes, 2011)
- Erste Schritte mit PARI/GP by Lars Fischer (13 pp., 2007; German)
- Class notes including PARI/GP tutorial and sample code by Masha Vlasenko (2013)
- Class notes, parts 12345sieve by Benjamin L. Levitt (41 pp., 2009; now offline?)
- Pari/GP Tutorial by Akinola Richard Olatokunbo
- Video demo of RSA in PARI/GP by Maren1955 (2014, 17:39)

### Papers on PARI/GP[edit]

- Bill Alombert, A new interpretor for PARI/GP,
*Journal de Théorie des Nombres de Bordeaux***20**:3 (2008), pp. 531–541. (English) - Paul Zimmermann, The Ups and Downs of PARI/GP in the last 20 years, Explicit Methods in Number Theory, October 15th-19th 2007
- Robert H. Lewis and Michael Wester, Comparison of polynomial-oriented computer algebra systems,
*ACM SIGSAM Bulletin***33**:4 (1999), pp. 5-13.

## Subcategories

This category has the following 3 subcategories, out of 3 total.

## Pages in category "PARI/GP"

The following 523 pages are in this category, out of 523 total.

### 2

### A

- A+B
- ABC Problem
- Abstract type
- Abundant, deficient and perfect number classifications
- Accumulator factory
- Ackermann function
- Address of a variable
- AKS test for primes
- Aliquot sequence classifications
- Almost prime
- Amb
- Amicable pairs
- Anagrams/Deranged anagrams
- Anonymous recursion
- Apply a callback to an array
- Arbitrary-precision integers (included)
- Archimedean spiral
- Arena storage pool
- Arithmetic-geometric mean
- Arithmetic-geometric mean/Calculate Pi
- Arithmetic/Complex
- Arithmetic/Integer
- Arithmetic/Rational
- Array concatenation
- Array length
- Arrays
- Assertions
- Associative array/Creation
- Associative array/Iteration
- Atomic updates
- Average loop length
- Averages/Arithmetic mean
- Averages/Mean angle
- Averages/Mean time of day
- Averages/Median
- Averages/Mode
- Averages/Pythagorean means
- Averages/Root mean square
- Averages/Simple moving average

### B

### C

- Caesar cipher
- Call a foreign-language function
- Call a function
- Call a function in a shared library
- Card shuffles
- Carmichael 3 strong pseudoprimes
- Case-sensitivity of identifiers
- Casting out nines
- Catalan numbers
- Catalan numbers/Pascal's triangle
- Catamorphism
- Chaos game
- Character codes
- Check Machin-like formulas
- Check that file exists
- Chinese remainder theorem
- Cholesky decomposition
- Circles of given radius through two points
- Closest-pair problem
- Closures/Value capture
- Code segment unload
- Collections
- Combinations
- Combinations and permutations
- Combinations with repetitions
- Comma quibbling
- Comments
- Compare a list of strings
- Compound data type
- Concurrent computing
- Conditional structures
- Conjugate transpose
- Constrained random points on a circle
- Continued fraction
- Continued fraction/Arithmetic/Construct from rational number
- Convert decimal number to rational
- Convert seconds to compound duration
- Conway's Game of Life
- Copy a string
- Count in factors
- Count in octal
- Count occurrences of a substring
- Count the coins
- Cramer's rule
- CRC-32
- Create a file
- Create a two-dimensional array at runtime
- Create an HTML table
- CSV data manipulation
- Cumulative standard deviation
- Currying

### D

- Day of the week
- Deal cards for FreeCell
- Deepcopy
- Delete a file
- Deming's Funnel
- Detect division by zero
- Determine if a string is numeric
- Digital root
- Digital root/Multiplicative digital root
- Dijkstra's algorithm
- Documentation
- Dot product
- Dragon curve
- Draw a cuboid
- Dutch national flag problem
- Dynamic variable names

### E

- Egyptian fractions
- Element-wise operations
- Elliptic curve arithmetic
- Emirp primes
- Empty directory
- Empty program
- Empty string
- Enforced immutability
- Entropy
- Entropy/Narcissist
- Environment variables
- Equilibrium index
- Ethiopian multiplication
- Euler's sum of powers conjecture
- Evaluate binomial coefficients
- Even or odd
- Evolutionary algorithm
- Exceptions
- Exceptions/Catch an exception thrown in a nested call
- Executable library
- Execute a system command
- Execute Brain****
- Execute HQ9+
- Exponentiation operator
- Exponentiation order
- Extend your language
- Extensible prime generator
- Extreme floating point values

### F

- Factorial
- Factors of a Mersenne number
- Factors of an integer
- Farey sequence
- Fast Fourier transform
- Faulhaber's formula
- Fibonacci n-step number sequences
- Fibonacci sequence
- Fibonacci word
- Fibonacci word/fractal
- File extension is in extensions list
- File input/output
- Filter
- Find common directory path
- Find first and last set bit of a long integer
- Find largest left truncatable prime in a given base
- Find limit of recursion
- Find palindromic numbers in both binary and ternary bases
- Find the last Sunday of each month
- Find the missing permutation
- First-class functions
- First-class functions/Use numbers analogously
- Five weekends
- FizzBuzz
- Flatten a list
- Flow-control structures
- Floyd's triangle
- Forest fire
- Fork
- Formal power series
- Formatted numeric output
- Forward difference
- Four bit adder
- Fractal tree
- Fractran
- Function composition
- Function definition
- Function prototype

### G

- Gamma function
- Gaussian elimination
- General FizzBuzz
- Generate Chess960 starting position
- Generate lower case ASCII alphabet
- Generator/Exponential
- Generic swap
- Get system command output
- Gray code
- Greatest common divisor
- Greatest element of a list
- Greatest subsequential sum
- Guess the number
- Guess the number/With feedback
- Guess the number/With feedback (player)
- GUI/Maximum window dimensions

### H

- Hailstone sequence
- Hamming numbers
- Happy numbers
- Harshad or Niven series
- Hash from two arrays
- Haversine formula
- Hello world/Newbie
- Hello world/Newline omission
- Hello world/Standard error
- Hello world/Text
- Heronian triangles
- Hickerson series of almost integers
- Higher-order functions
- History variables
- Hofstadter Q sequence
- Hofstadter-Conway $10,000 sequence
- Holidays related to Easter
- Horner's rule for polynomial evaluation
- Hostname

### I

- Identity matrix
- Idiomatically determine all the characters that can be used for symbols
- Idiomatically determine all the lowercase and uppercase letters
- Implicit type conversion
- Include a file
- Increment a numerical string
- Infinity
- Input/Output for Lines of Text
- Input/Output for Pairs of Numbers
- Integer comparison
- Integer overflow
- Integer sequence
- Interactive programming
- Introspection
- Inverted syntax
- Iterated digits squaring

### K

### L

- Langton's ant
- Largest int from concatenated ints
- Last Friday of each month
- Leap year
- Least common multiple
- Left factorials
- Letter frequency
- Levenshtein distance
- Linear congruential generator
- List comprehensions
- Literals/Floating point
- Literals/Integer
- Literals/String
- Logical operations
- Long multiplication
- Look-and-say sequence
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- LU decomposition
- Lucas-Lehmer test
- Ludic numbers

### M

- Machine code
- Magic squares of doubly even order
- Magic squares of odd order
- Mandelbrot set
- Map range
- Matrix arithmetic
- Matrix multiplication
- Matrix transposition
- Matrix-exponentiation operator
- Maximum triangle path sum
- MD4
- MD5
- Memory allocation
- Menu
- Metaprogramming
- Middle three digits
- Miller–Rabin primality test
- Modular arithmetic
- Modular exponentiation
- Modular inverse
- Monte Carlo methods
- Monty Hall problem
- Morse code
- Multifactorial
- Multiline shebang
- Multiple regression
- Multiplication tables
- Multiplicative order
- Mutual recursion

### N

- N'th
- Narcissist
- Narcissistic decimal number
- Non-continuous subsequences
- Non-decimal radices/Convert
- Non-decimal radices/Input
- Non-decimal radices/Output
- Nth root
- Null object
- Number names
- Number reversal game
- Numeric error propagation
- Numerical integration
- Numerical integration/Gauss-Legendre Quadrature

### O

### P

- Palindrome detection
- Pangram checker
- Paraffins
- Parallel calculations
- Parse command-line arguments
- Partial function application
- Pascal's triangle
- Pascal's triangle/Puzzle
- Password generator
- Pathological floating point problems
- Perfect numbers
- Perfect shuffle
- Permutations
- Permutations/Derangements
- Permutations/Rank of a permutation
- Pernicious numbers
- Pi
- Pick random element
- Playing cards
- Plot coordinate pairs
- Pointers and references
- Polynomial long division
- Polynomial regression
- Polyspiral
- Population count
- Power set
- Price fraction
- Primality by trial division
- Prime decomposition
- Primorial numbers
- Probabilistic choice
- Program name
- Program termination
- Proper divisors
- Pythagoras tree
- Pythagorean triples

### R

- Ramsey's theorem
- Random number generator (device)
- Random number generator (included)
- Random numbers
- Ranking methods
- Rate counter
- Read a file line by line
- Read a specific line from a file
- Read entire file
- Readline interface
- Real constants and functions
- Reduced row echelon form
- Remove duplicate elements
- Rename a file
- Rep-string
- Repeat
- Repeat a string
- Return multiple values
- Reverse a string
- RIPEMD-160
- Rock-paper-scissors
- Roman numerals/Decode
- Roman numerals/Encode
- Roots of a function
- Roots of a quadratic function
- Roots of unity
- Rot-13
- RSA code
- Run as a daemon or service
- Run-length encoding
- Runge-Kutta method
- Runtime evaluation
- Runtime evaluation/In an environment

### S

- Scope modifiers
- Search a list
- Self-describing numbers
- Semiprime
- Send an unknown method call
- Sequence of non-squares
- Sequence of primes by Trial Division
- Sequence of primorial primes
- Set
- Set consolidation
- Set of real numbers
- Set puzzle
- Seven-sided dice from five-sided dice
- SHA-1
- SHA-256
- Shell one-liner
- Short-circuit evaluation
- Show the epoch
- Sierpinski carpet
- Sierpinski triangle
- Sierpinski triangle/Graphical
- Sieve of Eratosthenes
- Sleep
- Sort an array of composite structures
- Sort an integer array
- Sort disjoint sublist
- Sort stability
- Sort using a custom comparator
- Sorting algorithms/Bead sort
- Sorting algorithms/Bogosort
- Sorting algorithms/Bubble sort
- Sorting Algorithms/Circle Sort
- Sorting algorithms/Cocktail sort
- Sorting algorithms/Comb sort
- Sorting algorithms/Counting sort
- Sorting algorithms/Gnome sort
- Sorting algorithms/Insertion sort
- Sorting algorithms/Merge sort
- Sorting algorithms/Pancake sort
- Sorting algorithms/Permutation sort
- Sorting algorithms/Quicksort
- Sorting algorithms/Selection sort
- Sorting algorithms/Shell sort
- Sorting algorithms/Stooge sort
- Sorting algorithms/Strand sort
- Special characters
- Special variables
- Speech synthesis
- Spiral matrix
- Stack
- Stair-climbing puzzle
- Start from a main routine
- Statistics/Basic
- Statistics/Normal distribution
- Stern-Brocot sequence
- String append
- String comparison
- String concatenation
- String interpolation (included)
- String length
- String matching
- String prepend
- Strip a set of characters from a string
- Substring
- Substring/Top and tail
- Subtractive generator
- Sudoku
- Sum and product of an array
- Sum digits of an integer
- Sum multiples of 3 and 5
- Sum of a series
- Sum of squares
- Symmetric difference
- System time

### T

- Table creation
- Taxicab numbers
- Temperature conversion
- Terminal control/Coloured text
- Terminal control/Ringing the terminal bell
- Test a function
- Test integerness
- Text processing/Max licenses in use
- The Twelve Days of Christmas
- Time a function
- Tokenize a string
- Top rank per group
- Topic variable
- Topswops
- Towers of Hanoi
- Trabb Pardo–Knuth algorithm
- Trigonometric functions
- Truncatable primes
- Truncate a file
- Truth table

### U

### V

- Execution method/Interpreted
- Execution method/Compiled
- Garbage collection/Yes
- Parameter passing/By reference
- Parameter passing/By value
- Typing/Weak
- Typing/Checking/Dynamic
- Programming Languages
- Programming paradigm/Dynamic
- Programming paradigm/Functional
- Programming paradigm/Procedural
- Mathematical programming languages