In accordance with our meta agreement, since one candidate received more votes than the others, we have a new featured language! Throughout March 2022, our Language of the Month will be:
PARI/GP
What's a Language of the Month?
See the meta post for nominations. In short, during March , those who wish to participate should learn (at least the basics of) PARI/GP, and use it to solve challenges. Participation is completely optional, but is anticipated to be fun!
Information about PARI/GP
PARI/GP is a CAS (Computer Algebra System) designed for number theory. It consists of two parts: PARI is a C library, GP is an interactive shell and a scripting language. Even if you are not familiar with algebraic number theory, GP is still a powerful language for golfing math problems.
Reasons
- Intuitive syntax and good documentations. Easy to learn.
- Built-in types for vectors, matrices, polynomials, power series, and many other math objects.
- Lots of built-ins, especially for number theory, but also for linear algebra, polynomials, and other branches of algebra.
- Single byte operator
#
for length (of vectors, matrices, strings, etc.). - Many OEIS pages have a PARI/GP program for the sequence.
Caveats
- Not so many built-ins outside of math. On the other hand, this force you to think out of the box, for example, using polynomials to solve array challenges.
- Very limited array programming. You can add two vector or multiply a vector by a scalar, but there is no built-in to do element-wise multiplication.
- You need to know some math to master the language.
- The version on TIO is somewhat out of date.
Resources
- Official website
- Tutorial
- TIO
- ATO
- Run PARI/GP in your browser
- Golfing tips
- Reference card for 2.13.3 (the newest version)
- Reference card for 2.11.1 (the version on TIO)
Bounties
I (alephalpha) will be offering a +50 rep bounty to any user's first PARI/GP answer during this month, and +200 to any user's tenth PARI/GP answer during this month. This includes using the GP scripting language, or using the PARI lib in a C/C++ answer.