A216479 a(n) is the least multiple of n which uses only the digit 1, or a(n) = -1 if no such multiple exists.
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
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..1000
Crossrefs
Programs
-
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 *)
-
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
Comments