|
|
A062689
|
|
Smallest square that contains the digits of n in its exact middle.
|
|
1
|
|
|
0, 1, 121, 12321, 4, 256, 169, 576, 289, 9, 8100, 2116, 361201, 3136, 181476, 1156, 16, 101761, 5184, 281961, 2209, 9216, 1225, 182329, 3249, 25, 292681, 192721, 8281, 1296, 2304, 183184, 5329, 343396, 203401, 4356, 36, 223729, 173889, 7396, 2401
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,easy,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|