%I #22 Apr 25 2020 02:01:47
%S 16,25,36,49,529,64,729,81,900,100,1156,121,1369,144,1521,169,1764,
%T 1849,196,2025,2116,225,2304,2401,256,2601,2704,289,2916,3025,3136,
%U 324,3364,3481,35344,361,3721,3844,3969,400,41209,4225,4356,441
%N Smallest nontrivial extension of n which is a square.
%C A trivial extension would mean appending no digits at all when n is already a square. With trivial extensions allowed, this sequence becomes A018796.
%H N. J. A. Sloane, <a href="/A030666/b030666.txt">Table of n, a(n) for n = 1..20000</a>
%F a(n) = A030667(n)^2.
%e 80 is not a perfect square, but 81 = 9^2, so a(8) = 81.
%e Although 9 is already a square, we need to append at least one digit. However, none of 90, 91, 92, ..., 99 are squares. Then we try 900 = 30^2, so a(9) = 900.
%p # Program which computes 20000 terms, from _N. J. A. Sloane_, Nov 24 2015
%p for b from 1 to 20000 do
%p sw1:=-1:
%p for p from 1 to 6 do
%p bp:=b*10^p;
%p for i from 0 to 10^p-1 do
%p if issqr(bp+i) then lprint(b,bp+i); sw1:=1; break; fi;
%p od:
%p if sw1 > 0 then break; fi;
%p od:
%p if sw1 < 0 then lprint("failed at b = ",b); fi;
%p od:
%o (Python)
%o from gmpy2 import isqrt
%o def A030666(n):
%o d, nd = 10, 10*n
%o while True:
%o x = (isqrt(nd-1)+1)**2
%o if x < nd+d:
%o return int(x)
%o d *= 10
%o nd *= 10 # _Chai Wah Wu_, May 24 2016
%Y Cf. A030667, A030686, A018796.
%Y See A264604 for another version (first differs at a(9)).
%K nonn,base
%O 1,1
%A _Patrick De Geest_