login
Numbers m such that m^2 can be obtained from m by inserting an internal block of (contiguous) digits.
5

%I #21 Aug 27 2021 16:59:56

%S 0,1,10,11,95,96,100,101,125,976,995,996,1000,1001,1025,1376,9625,

%T 9976,9995,9996,10000,10001,10025,10376,10625,99376,99625,99976,99995,

%U 99996,100000,100001,100025,100376,100625,109376,990625,999376,999625,999976

%N Numbers m such that m^2 can be obtained from m by inserting an internal block of (contiguous) digits.

%C All terms of this sequence appear in A086457. - _Jeremy Gardiner_, Jul 20 2003

%C It seems that for any nonnegative integer k the number of k-digit terms is 2k. - _Ivan N. Ianakiev_, Aug 17 2021

%H Reinhard Zumkeller, <a href="/A045953/b045953.txt">Table of n, a(n) for n = 1..100</a>

%H J. Knoderer, <a href="https://web.archive.org/web/20090910061731/http://www.mazes.com/sequence.html">What number comes next? (an interesting sequence)</a>

%e 95^2 = 9025 (insert '02' inside '95').

%o (Haskell)

%o import Data.List (isPrefixOf, inits, isSuffixOf, tails)

%o a045953 n = a045953_list !! (n-1)

%o a045953_list = filter chi a008851_list where

%o chi n = (x == y && xs `isSub'` ys) where

%o x:xs = show $ div n 10

%o y:ys = show $ div (n^2) 10

%o isSub' us vs = any id $ zipWith (&&)

%o (map (`isPrefixOf` vs) $ inits us)

%o (map (`isSuffixOf` vs) $ tails us)

%o -- _Reinhard Zumkeller_, Jul 27 2011

%Y Cf. A046851, A008851, A018834.

%K base,nonn,nice,easy

%O 1,3

%A John "MazeMan" Knoderer (Webmaster(AT)Mazes.com)