n * k = dd0d00d where d = ...?

JavaScript (ES6), 83 bytes

n=>{for(p=1;;p=k)for(d=0;d++<9;)for(k=p;k<p+p;k++)if(k.toString(2)*d%n<1)return d;}

Now returns 6 for n=252! I tried a recursive approach but it's also 83 bytes and crashes out for me for the harder numbers:

f=(n,p=1,d=1,k=p)=>k<p+p?k.toString(2)*d%n<1?d:f(n,p,d,k+1):d>8?f(n,p+p):f(n,p,d+1)

Mathematica, 103 100 97 bytes

#&@@IntegerDigits[Sort[Join@@Table[Cases[FromDigits/@{0,i}~Tuples~13/#,_Integer],{i,9}]][[10]]#]&


finds 317 in 0.39 sec

Try it online copy/paste the code, add [317] at the end and press shift+enter to run

-3 bytes from @JungHwan Min
-3 bytes from @Keyu Gan


Jelly, 16 15 14 bytes

²B€Ḍ9×þF%Þ¹ḢQS

Quadratic runtime (under 25 seconds on TIO).

Try it online!

Alternate version, 15 bytes

2ȷB€Ḍ9×þF%Þ¹ḢQS

Constant runtime (approx. 1 second on TIO).

Try it online!

How it works

²B€Ḍ9×þF%Þ¹ḢQS  Main link. Argument: n

²               Take the square of n.
                This bound is high enough for all integers up to 500. 
                In fact, The highest value we need is 1387 for input 471, so
                2000 (2ȷ) is also enough (and a lot faster).

 B€             Binary; convert 1, ..., 4159 to base 2.
   Ḍ            Undecimal; convert each digit array from base 10 to integer.
                This generates the array A of all positive integers up to n²
                whose decimal representations consist entirely of 1's and 0's.
    9×þ         9 multiply table; for each x in A, yield [x, 2x, ..., 8x, 9x].
       F        Flatten; concatenate the resulting arrays, yielding the vector
                V. Note that V contains all numbers that match the regex ^d[0d]*$
                in base 10, in ascending order.
          ¹     Identity; yield n.
        %Þ      Sort the entries for V by their remainders modulo n. This places
                multiples of n at the beginning. The sorting algorithm in stable,
                so the first element of sorted V is the smallest multiple of n.
           Ḣ    Head; extract the first element.
            Q   Unique; deduplicate its digits in base 10. This yields [d, 0].
             S  Take the sum, yielding d.