OFFSET
1,1
PROG
(PARI) /* z(n)!=0 iff n is in the sequence */
z(n)= { local(a, b, c, d, e, f, g, h, i, j, k);
b=a=sqrtint(n); d=f=i=1; e=g=h=0; j=c=n-a^2; if(!c, return(0));
until((a==b)&&(c==j), k=d+a*e; f*=c; d=a*d+e*n; e=k; g+=i; i*=c;
k=g+a*h; g=a*g+h*n; h=k; k=(a+b)\c; g-=i*k; a=c*k-a; c=(n-a^2)/c);
d=d/f-1; e/=f; g/=i; h/=i; i=d^2-n*e^2; k=h*d-g*e; g=g*d-h*e*n;
b=n-a^2; a=b*g-c*a*i; c=b*k+i*c; b*=i; !a*(2%(b/gcd(b, n*c))); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Baruchel, Oct 21 2003
STATUS
approved