A370004 Least k>0 such that the decimal expansion of k^2 contains k+n as a substring.
1, 11, 2, 13, 104, 14, 3, 15, 108, 16, 11, 17, 4, 39, 18, 77, 760, 19, 52, 117, 5, 118, 34, 21, 120, 121, 22, 41, 123, 23, 6, 125, 12, 24, 42, 128, 504, 25, 352, 130, 16, 26, 7, 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
Offset: 0
Examples
a(3) = 13 because 13 is the least positive integer such that 13^2 = 169 contains 13 + 3 = 16 as a substring. a(4) = 104 because 104 is the least positive integer such that 104^2 = 10816 contains 104 + 4 = 108 as a substring.
Links
- Michael S. Branicky, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
Table[k=1;While[!StringContainsQ[ToString[k^2],ToString[k+n]],k++];k,{n,0,70}] lks[n_]:=Module[{k=1},While[SequenceCount[IntegerDigits[k^2],IntegerDigits[k+n]]==0,k++];k]; Array[lks,80,0] (* Harvey P. Dale, May 26 2025 *)
-
PARI
a(n) = my(k=1); while (#strsplit(Str(k^2), Str(k+n))<2, k++); k; \\ Michel Marcus, Feb 07 2024
-
Python
from itertools import count def a(n): return next(k for k in count(1) if str(k+n) in str(k*k)) print([a(n) for n in range(71)]) # Michael S. Branicky, Feb 07 2024
Comments