A381526 a(n) is the smallest positive integer k such that the decimal expansion of k is a substring of the decimal expansion of n*k, or -1 if no such number exists.
-1, 1, -1, 5, -1, 5, 2, 5, -1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 9, 5, 72, 5, 2, 5, 6, 5, 5, 1, 91, 5, 42, 4, 2, 4, 36, 5, -1, 1, 94, 5, 3, 3, 2, 5, 8, 5, 5, 1, 24, 5, 7, 5, 2, 5, 21, 5, 2, 1, 2, 2, 2, 5, 2, 5, 7, 5, 5, 1, 484, 5, 47, 5, 2, 3, 3, 3, -1
Offset: 0
Examples
44*1 = 44 does not have 1 as a substring. 44*2 = 88 does not have 2 as a substring. 44*3 = 132 has 3 as a substring. So, a(44) = 3.
Links
- Dominic McCarty, Table of n, a(n) for n = 0..10000
- Dominic McCarty, Proof that a(2) = a(4) = a(8) = -1
Programs
-
PARI
a(n) = if ((n==0) || (n==2) || (n==4) || (n==8), return(-1)); if (n%10, my(k=1); while (#strsplit(Str(n*k), Str(k)) < 2, k++); k, a(n/10)); \\ Michel Marcus, Feb 26 2025
-
Python
from itertools import count def a(n): if n in [0, 2, 4, 8]: return -1 if n % 10 == 0: return a(n//10) for k in count(1): if str(k) in str(k*n): return k print([a(n) for n in range(100)])