OFFSET
0,3
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..9999
EXAMPLE
8100 is the smallest square that contains 10 in its exact center.
PROG
(Python)
def centered(s, t):
q, r = divmod(len(t)-len(s), 2)
return r == 0 and t[q:].startswith(s)
def a(n):
k, target = 0, str(n)
while not centered(target, str(k**2)): k += 1
return k**2
print([a(n) for n in range(43)]) # Michael S. Branicky, Feb 16 2022
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Erich Friedman, Jul 04 2001
EXTENSIONS
Corrected and extended by Harvey P. Dale, Jul 21 2001
a(40) from Bernard Schott, Feb 16 2022
STATUS
approved