A290647 a(n) is the position of first occurrence of n^2 in the concatenation of the positive integers in decimal representation.
1, 4, 9, 22, 40, 62, 88, 83, 27, 190, 14, 322, 397, 478, 565, 658, 757, 37, 299, 1090, 323, 86, 777, 141, 660, 124, 783, 1325, 443, 2590, 479, 2986, 3246, 3514, 3790, 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
Offset: 1
Examples
s = 123456789101112131415161718192021222324252627282930313233343536... . a(4) = 22 because the first occurrence of 4^2 = 16 in s starts at the 22nd digit.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Zhining Yang)
Programs
-
Mathematica
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 *) 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 *)
-
VBA
Sub test() Dim i&, t$ For i = 1 To 10000 t = t & i Next For i = 1 To 100 Debug.Print InStr(t, i ^ 2); ","; Next End Sub