login
A216479
a(n) is the least multiple of n which uses only the digit 1, or a(n) = -1 if no such multiple exists.
3
1, -1, 111, -1, -1, -1, 111111, -1, 111111111, -1, 11, -1, 111111, -1, -1, -1, 1111111111111111, -1, 111111111111111111, -1, 111111, -1, 1111111111111111111111, -1, -1, -1, 111111111111111111111111111, -1, 1111111111111111111111111111, -1, 111111111111111, -1, 111111, -1, -1, -1, 111, -1, 111111, -1, 11111, -1
OFFSET
1,3
COMMENTS
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
MATHEMATICA
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 *)
PROG
(Python)
def A216479(n):
if n % 2 == 0 or n % 5 == 0:
return -1
rem = 1
while rem % n != 0:
rem = rem*10 + 1
return rem
# Azanul Haque, Nov 28 2020
CROSSREFS
Cf. A084681 (number of 1's), A190301 (multiplier).
Sequence in context: A280142 A077573 A266435 * A123698 A123727 A282915
KEYWORD
sign,base
AUTHOR
V. Raman, Sep 07 2012
STATUS
approved