/usr/share/doc/pari-gp/examples/classno.gp is in pari-gp 2.5.0-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | \\ --------------- GP code ---------------------------------------
\\
\\ Time-stamp: <Fri, Mar 26, 1999 - 14:13:17 - villegas@linux47>
\\
\\ Description: Compute class number of imaginary quadratic field
\\ analytically
\\
\\ File: classno.gp
\\
\\ Original Author: Fernando Rodriguez-Villegas
\\ villegas@math.utexas.edu
\\ University of Texas at Austin
\\
\\ Created: Fri Mar 26 1999
\\-----------------------------------------------------------------
\\ Class number h(-d), -d fundamental.
\\ Adjust constant cc for accuracy, default at least 9 decimal places.
cl(d,cc) =
{
my(q0,sd,t,c, s = 0, q = 1);
if (!isfundamental(-d), error("Discriminant not fundamental"));
if (!cc, cc = 5);
sd = sqrt(d);
q0 = exp(-2*Pi/sd); c = -4*Pi/sd;
for (n=1, ceil(sd*cc),
q *= q0; t = 1/(1-q);
s += kronecker(-d,n) * q * t * (1 + c*t*n)
);
if (d==3, s *= 3);
if (d==4, s *= 2);
-2*s;
}
|