/usr/share/doc/pari-gp/examples/contfrac.gp is in pari-gp 2.7.5-1.
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 | period(D) =
{ my(u,v,j,r,s);
if (type(D) != "t_INT" || D < 2, return(-1));
u = sqrtint(D); v = D-u^2;
if (!v, return(0));
s = v;
r = u; j = 0;
until (u == r && v == s,
u = (r+u)\v * v - u;
v = (D-u^2)\v; j++;
); j;
}
|