## calculate the value of sum[n=1..oo] x^(2^(-n))-1 ## i.e. sum of repeated square roots, less one. define ss(x) { auto s,t,os; if(x<=0){print "Negative Infinity\n";-1/0} scale+=6 s=x ; os=s+1 t=0;while(os!=s){ os=s s=sqrt(s) t+=s-1 } scale-=6;t/=1 return(t); } define ss_n(n,x) { # Generalisation of ss; ss(x) == ss_n(2,x) auto s,t,os; if(x<=0){print "Negative Infinity\n";-1/0} if(n==2)return(ss(x)) if(n<=1){print "Infinity\n";1/0} scale+=6 s=x ; os=s+1 t=0;while(os!=s){ os=s s=e(l(s)/n) t+=s-1 } scale-=6;t/=1 return(t); }