Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 Dec 27 2022 02:38:30
%S 1,1,4,3,-1,2,3,14,1358,-1,1,1,17,8,-1,7,13,679,59,-1,1,1,527,88,-1,
%T 47,786,4,418,-1,362,66,34,33,-1,617,3,319,2849,-1,271,291,284,48,-1,
%U 2657,26,44,229,-1,22,406,4,393,-1,2,3723,209,19,-1,2,181,194,33,-1,17,33,1634,3219,-1,172,1696,2907,3,-1,1462,1443,1554,28,-1,262,271,134,1443
%N a(n) is the least value of k such that k*n uses only digits 1 and 2. a(n) = -1 if no such multiple exists.
%H Robert Israel, <a href="/A216482/b216482.txt">Table of n, a(n) for n = 1..10000</a>
%p f:= proc(n) local d,a,i,S,R;
%p if n mod 5 = 0 then return -1 fi;
%p for d from ilog10(n)+1 do
%p a:= (10^d-1)/9;
%p S:= [seq(10^i, i=0..d-1)];
%p R:= select(t -> convert(t,`+`) + a mod n = 0, combinat:-powerset(S));
%p if R <> [] then return min(map(t -> convert(t,`+`)+a, R))/n fi
%p od
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Dec 26 2022
%Y Cf. A004290, A079339, A181060, A181061.
%K sign,base,look
%O 1,3
%A _V. Raman_, Sep 07 2012