Mathematica, 82 bytes
Using the pattern of submission from @Jenny_mathy 's answer...
(d=x=1;y=0;f:=(10^x-1)10^y;n:=If[y>0,y--;x++,y=d;d++;x=1];While[Mod[f,#]!=0,n];f)&
Input:
[17]
Output:
9999999999999999
And relative to the argument in comments at @Jenny_mathy's answer with @Phoenix ... RepeatedTiming[] of application to the input [17] gives
{0.000518, 9999999999999999}
so half a millisecond. Going to a slightly larger input, [2003] :
{3.78, 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999}
a bit under 4 seconds.
Test table: On the first 30 positive integers, the results are
{9, 90, 9, 900, 90, 90, 999999, 9000, 9, 90, 99, 900, 999999,
9999990, 90, 90000, 9999999999999999, 90, 999999999999999999, 900,
999999, 990, 9999999999999999999999, 9000, 900, 9999990, 999,
99999900, 9999999999999999999999999999, 90}
설명 : 여기서 유일한 마법은 커스텀 반복자 (M'ma 감각이 아닌 CS 의미의 "반복자")입니다.
n := If[ y>0 , y-- ; x++ , y=d ; d++ ; x=1]
전역 변수 x, 선행 "9" y수, 후행 "0" d수 및 총 자릿수에 작용합니다. 우리는 자릿수를 반복하고 각 자릿수를 선택할 때마다 가장 높은 "0"과 가장 작은 "9"로 시작합니다. 따라서 코드가 수행하는 첫 번째 작업은 d1 로 초기화 되어 1 x과 y0으로 강제 설정 됩니다. 사용자 정의 반복기는 "0"문자열을 단축 할 수 있는지 확인합니다. 그렇다면 "0"문자열을 하나씩 줄이고 "1"문자열을 하나씩 증가시킵니다. 그렇지 않은 경우 자릿수를 늘리고 "0"수를 자릿수보다 1만큼 작게 설정하고 "9"수를 1로 설정합니다.d is the desired value of y.)