/* bc program padic */ /* 16th March 2011 */ /* p an odd prime, not dividing a. * a[0]^2=a (mod p), 1<=a[0]

=1. * a[n-1]^2=a (mod p^n) * k=(a[n-1]^2-a)/p^n * k+2a[n-1]b[n]=0 (mod p), 0<=b[n]=1. * a[0]=1=> x=1+0*2+b[1]2^2+b[2]2^3+ * a[0]=3=> x=1+1*2+b[1]2^2+b[2]2^3+ * k=(a[n-1]^2-a)/2^(n+2) * b[n]=k (mod 2), b[n]=0 or 1. * a[n]<2^(n+2) */ define twoadic(a,n){ auto i,t,x,pp,temp,k,nn if(n<2){ print "n<2\n" return } nn=n-1 pp=4 x=1 /*print "x:",x," "*/ print "1,0," for(i=1;i