dim a(1e4):for i=0to 1117if i<169for j=1to 5e3a(j)=max(j*2,a(j+j/(a(i)+!i)))next ?a(i)+1;next