I am given a number k in the range 1 to 10000. The problem is to find the smallest multiple that can be written only with the digit 1 (known as a [repunit](https://en.wikipedia.org/wiki/Repunit)). So for k=3 the solution is 111 because 3 divides 111, but 3 does not divide 1 or 11. For k=7, the solution is 111111 (six ones).

How to calculate the solution for any k?

I understand I need to use remainders since the solution can be very big (or I suppose use a BigInteger class)