%I #27 Dec 21 2022 14:30:51
%S 1,4,9,22,40,62,88,83,27,190,14,322,397,478,565,658,757,37,299,1090,
%T 323,86,777,141,660,124,783,1325,443,2590,479,2986,3246,3514,3790,
%U 4074,4366,4666,346,5290,394,5946,6286,6634,6990,3541,7261,8106,3851,8890,3931,9706,10126,5408,9012,4345,8865,981,4283,13290,4379
%N a(n) is the position of first occurrence of n^2 in the concatenation of the positive integers in decimal representation.
%H Michael S. Branicky, <a href="/A290647/b290647.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Zhining Yang)
%e s = 123456789101112131415161718192021222324252627282930313233343536... .
%e a(4) = 22 because the first occurrence of 4^2 = 16 in s starts at the 22nd digit.
%t t = ""; k = 0; Table[ While[(z = StringPosition[t, ToString[n^2], 1]) == {}, t = t <> ToString[++k]]; z[[1, 1]], {n, 61}] (* _Giovanni Resta_, Aug 11 2017 *)
%t Module[{nn=15000,s},s=Flatten[IntegerDigits/@Range[nn]];Flatten[Table[ SequencePosition[s,IntegerDigits[n^2],1],{n,70}],1]][[All,1]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jul 05 2021 *)
%o (VBA)
%o Sub test()
%o Dim i&, t$
%o For i = 1 To 10000
%o t = t & i
%o Next
%o For i = 1 To 100
%o Debug.Print InStr(t, i ^ 2); ",";
%o Next
%o End Sub
%Y Cf. A031297, A290787.
%K nonn,look,base
%O 1,2
%A _Zhining Yang_, Aug 08 2017
|