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
Michael S. Branicky, Table of n, a(n) for n = 0..10000
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
KEYWORD
nonn,base
AUTHOR
Giorgos Kalogeropoulos, Feb 07 2024
STATUS
approved