login
Smallest number whose square begins and ends with the same n digits, and with any other digit(s) in between.
4

%I #11 Mar 01 2014 04:23:23

%S 11,173,3489,16262,193744,2445865,38981039,112791955,1580178016,

%T 10578937381,36363636364,1010690961795,14451789007487,104501463604086,

%U 1242844268897055,11773101257925379,181883353790860701,1818181815181818182,11678332116788271168

%N Smallest number whose square begins and ends with the same n digits, and with any other digit(s) in between.

%C 11^2 = 121; 173^2= 29929; 3489^2= 12173121; 16262^2= 264452644; etc.

%H Giovanni Resta, <a href="/A161355/b161355.txt">Table of n, a(n) for n = 1..60</a>

%t sol[nd_, ec_, ecv_] := Block[{r = Reduce[x*(1 + 10^(nd + ec)) + ecv*10^nd == y^2 && y > 0 && 10^(nd - 1) <= x < 10^nd, {x, y}, Integers]}, If[r === False, {}, y /. List@ToRules@r]]; all[nd_, ec_] := Block[{s, yy, my = 0}, Do[ s = sol[nd, ec, k]; If[s != {}, yy = Min[s]; If[my == 0, my = yy, my = Min[my, yy]]], {k, 0, 10^ec - 1}]; my]; a[n_] := Block[{v, md = 0}, While[(v = all[n, md]) == 0, md++]; v]; Array[a, 15] (* _Giovanni Resta_, Mar 01 2014 *)

%Y Cf. A230604.

%K nonn,base

%O 1,1

%A _Claudio Meller_, Jun 07 2009

%E a(5) corrected by _Arkadiusz Wesolowski_, Feb 28 2014

%E a(9)-a(19) from _Giovanni Resta_, Feb 28 2014