%I #23 Dec 12 2020 05:19:35
%S 1,-1,111,-1,-1,-1,111111,-1,111111111,-1,11,-1,111111,-1,-1,-1,
%T 1111111111111111,-1,111111111111111111,-1,111111,-1,
%U 1111111111111111111111,-1,-1,-1,111111111111111111111111111,-1,1111111111111111111111111111,-1,111111111111111,-1,111111,-1,-1,-1,111,-1,111111,-1,11111,-1
%N a(n) is the least multiple of n which uses only the digit 1, or a(n) = -1 if no such multiple exists.
%C a(n) = -1 if and only if n is a multiple of 2 or 5. See comment in A216485. - _Chai Wah Wu_, Jun 21 2015
%H Chai Wah Wu, <a href="/A216479/b216479.txt">Table of n, a(n) for n = 1..1000</a>
%t Array[Which[GCD[#, 10] != 1, -1, Mod[#, 3] == 0, Block[{k = 1}, While[Mod[k, #] != 0, k = 10 k + 1]; k], True, (10^MultiplicativeOrder[10, #] - 1)/9] &, 42] (* _Michael De Vlieger_, Dec 11 2020 *)
%o (Python)
%o def A216479(n):
%o if n % 2 == 0 or n % 5 == 0:
%o return -1
%o rem = 1
%o while rem % n != 0:
%o rem = rem*10 + 1
%o return rem
%o # _Azanul Haque_, Nov 28 2020
%Y Cf. A084681 (number of 1's), A190301 (multiplier).
%Y Cf. A004290, A079339, A181060, A181061.
%K sign,base
%O 1,3
%A _V. Raman_, Sep 07 2012