Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #16 Mar 02 2024 14:07:21
%S 1,11,2,13,104,14,3,15,108,16,11,17,4,39,18,77,760,19,52,117,5,118,34,
%T 21,120,121,22,41,123,23,6,125,12,24,42,128,504,25,352,130,16,26,7,
%U 133,377,27,322,135,136,44,26,393,24,747,139,29,8,141,108,142,30,143,22,144,380,31,606,146,1064,147,32
%N Least k>0 such that the decimal expansion of k^2 contains k+n as a substring.
%C This sequence is defined for all n. Proof: Given n, consider k = 10^x + n where 10^x > n^2. Since k^2 = (k+n) * 10^x + n^2, k^2 contains k+n as a substring. Furthermore, x = ceiling(log_10(1+n^2)) satisfies the inequality, therefore a(n) <= 10^ceiling(log_10(1+n^2)) + n. - _Jason Yuen_, Feb 26 2024
%H Michael S. Branicky, <a href="/A370004/b370004.txt">Table of n, a(n) for n = 0..10000</a>
%e a(3) = 13 because 13 is the least positive integer such that 13^2 = 169 contains 13 + 3 = 16 as a substring.
%e a(4) = 104 because 104 is the least positive integer such that 104^2 = 10816 contains 104 + 4 = 108 as a substring.
%t Table[k=1;While[!StringContainsQ[ToString[k^2],ToString[k+n]],k++];k,{n,0,70}]
%o (PARI) a(n) = my(k=1); while (#strsplit(Str(k^2), Str(k+n))<2, k++); k; \\ _Michel Marcus_, Feb 07 2024
%o (Python)
%o from itertools import count
%o def a(n): return next(k for k in count(1) if str(k+n) in str(k*k))
%o print([a(n) for n in range(71)]) # _Michael S. Branicky_, Feb 07 2024
%Y Cf. A000290, A018834.
%K nonn,base
%O 0,2
%A _Giorgos Kalogeropoulos_, Feb 07 2024