Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A370004
Least k>0 such that the decimal expansion of k^2 contains k+n as a substring.
1
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,2
COMMENTS
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
LINKS
EXAMPLE
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.
MATHEMATICA
Table[k=1; While[!StringContainsQ[ToString[k^2], ToString[k+n]], k++]; k, {n, 0, 70}]
PROG
(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
CROSSREFS
Sequence in context: A303785 A262369 A092260 * A318926 A336874 A040120
KEYWORD
nonn,base
AUTHOR
STATUS
approved