Current Path : /usr/local/share/doc/pari/examples/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/local/share/doc/pari/examples/contfrac.gp |
period(D) = { local(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 }