OFFSET
1,1
COMMENTS
A trivial extension would mean appending no digits at all when n is already a square. With trivial extensions allowed, this sequence becomes A018796.
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..20000
FORMULA
a(n) = A030667(n)^2.
EXAMPLE
80 is not a perfect square, but 81 = 9^2, so a(8) = 81.
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.
MAPLE
# Program which computes 20000 terms, from N. J. A. Sloane, Nov 24 2015
for b from 1 to 20000 do
sw1:=-1:
for p from 1 to 6 do
bp:=b*10^p;
for i from 0 to 10^p-1 do
if issqr(bp+i) then lprint(b, bp+i); sw1:=1; break; fi;
od:
if sw1 > 0 then break; fi;
od:
if sw1 < 0 then lprint("failed at b = ", b); fi;
od:
PROG
(Python)
from gmpy2 import isqrt
def A030666(n):
d, nd = 10, 10*n
while True:
x = (isqrt(nd-1)+1)**2
if x < nd+d:
return int(x)
d *= 10
nd *= 10 # Chai Wah Wu, May 24 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved