Several examples of complete and non-trivial GP programs are given in this directory (as well as the C program mattrans.c using the Pari library described in Chapter 4 of the users' manual). This file gives a brief description of these programs. All these programs should be read into GP by the command \r file. 1) bench.gp This program computes the first 1000 terms of the Fibonacci sequence, the product p of successive terms, and the lowest common multiple q. It outputs the ratio log(p)/log(q) every 10 terms (this ratio tends to pi^2/6 as k tends to infinity). The name bench.gp comes from the fact that this program is one (among many) examples where GP/PARI performs orders of magnitude faster than systems such as Maple or Mathematica (try it!). 2) clareg.gp Written entirely in the GP language without using the function buchgen, the programs included in this file allow you in many cases to compute the class number, the structure of the class group and a system of fundamental units of a general number field (this programs sometimes fails to give an answer). It can work only if initalg finds a power basis. Evidently it is much less powerful and much slower than the function buchgen, but it is given as an example of a sophisticated use of GP. The first thing to do is to call the function clareg(pol,limp,lima,extra) where pol is the monic irreducible polynomial defining the number field, limp is the prime factor base limit (try values between 19 and 113), lima is another search limit (try 50 or 100) and extra is the number of desired extra relations (try 2 to 10). The program prints the number of relations that it needs, and tries to find them. If you see that clearly it slows down too much before succeeding, abort and try other values. If it succeeds, it will print the class number, class group, regulator. These are tentative values. Then use the function check(lim) (take lim=200 for example) to check if the value is consistent with the value of the L-series (the value returned by check should be close to 1). Finally, the function fu() (no parameters) returns a family of units which generates the unit group (you must extract a system of fundamental units yourself). 3) lucas.gp The half line function lucas(p) defined in this file performs the Lucas-Lehmer primality test on the Mersenne number 2^p-1. If the result is 1, the Mersenne number is prime, otherwise not. 4) rho.gp A simple implementation of Pollard's rho method. The function rho(n) outputs the complete factorization of n in the same format as factor. 5) squfof.gp This defines a function squfof of a positive integer variable n, which may allow you to factor the number n. SQUFOF is a very nice factoring method invented in the 70's by D. Shanks for factoring integers, and is reasonably fast for numbers having up to 15 or 16 digits. The squfof program which is given is a very crude implementation. It also prints out some intermediate information as it goes along. The final result is some factor of the number to be factored. 6) tutnf.gp This is the sequence of GP instructions given in the tutorial in the section on general number fields. 7) tutnfout This is the slightly edited output of running tutnf.gp (obtained by removing the ? at the beginning of each command for more legibility).