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
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.
public static void divide(int num)