Division problem

Problem statement- 3 divides 111 , 13 divides 111111 etc.. find a number having all one’s which is shortest divisible by a given number which has 3 as its last digit.

Logic- The challenge here is that you will soon run out of limit for int or long if you keep on increasing the number. So the idea is to divide in a way which you used to do on paper for large numbers

13)111111(8547
104
——-
71
65
——–
61
54
———-
71
71
————
0

Start with 1 (or 11) and keep adding one, keep a count of 1s added, divide by the required number unless the reminder is 0.

Implementation
public static void divide(int num)
{
int division=11;
int count=2;
while(true)
{
if(division%num==0)
{
System.out.println("count:"+count);
break;
}
else
{
int remindor=division%num;
division=remindor*10+1;
count++;
}
}
}