login
A030666
Smallest nontrivial extension of n which is a square.
5
16, 25, 36, 49, 529, 64, 729, 81, 900, 100, 1156, 121, 1369, 144, 1521, 169, 1764, 1849, 196, 2025, 2116, 225, 2304, 2401, 256, 2601, 2704, 289, 2916, 3025, 3136, 324, 3364, 3481, 35344, 361, 3721, 3844, 3969, 400, 41209, 4225, 4356, 441
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
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
See A264604 for another version (first differs at a(9)).
Sequence in context: A319388 A291334 A175689 * A030676 A264604 A348235
KEYWORD
nonn,base
STATUS
approved