login
Smallest positive k such that k*n contains only the digits 1,2,3,4,5, or -1 if no such k exists.
2

%I #23 Dec 04 2019 10:59:22

%S -1,1,1,1,1,1,2,2,3,5,-1,1,1,1,1,1,2,2,3,6,-1,1,1,1,1,1,2,2,4,5,-1,1,

%T 1,1,1,1,4,3,3,6,-1,1,1,1,1,1,7,3,3,5,-1,1,1,1,1,1,2,2,4,6,-1,2,2,4,8,

%U 5,2,2,8,5,-1,2,2,7,3,3,2,2,3,7,-1,3,16,4,3,3,4,5,4,5,-1

%N Smallest positive k such that k*n contains only the digits 1,2,3,4,5, or -1 if no such k exists.

%C a(n) > 0 iff n is not a multiple of 10.

%D G. Galperin and Y. J. Ionin (Proposers), and M. Reid (Solver), Problem 12034, Amer. Math. Monthly, 126:10, 950-951, Dec. 2019.

%H Rémy Sigrist, <a href="/A329792/b329792.txt">Table of n, a(n) for n = 0..25000</a>

%o (Python)

%o def A329792(n):

%o if n % 10:

%o m, s = 1, set('12345')

%o while not set(str(m*n)) <= s:

%o m += 1

%o return m

%o else:

%o return -1 # _Chai Wah Wu_, Dec 04 2019

%Y Cf. A084545, A329793.

%K sign,look,base

%O 0,7

%A _N. J. A. Sloane_, Dec 03 2019