/* e.n < sqrt(a(n)) < e.(n+1) for some integer e */ /* (e.n)^2 < a(n) < (e.(n+1))^2 */ /* ceil((e.n)^2) <= a(n) <= floor((e.(n+1))^2) */ a(n)=my(f=n,p=1,e); \ while(f>=1, \ f=f/10;p=p/10 \ ); \ e=1; \ while(ceil((e+f)^2)>floor((e+f+p)^2) \ || issquare(ceil((e+f)^2)), \ e=e+1 \ ); \ return(ceil((e+f)^2)) /* 0 is a very special case */ print("0 26") for(n=1, 10000, print(n" "a(n)))