def f(y,p,b): i=y*n//p;b+=i&1;p*=2 if(b,y)<c[i]:c[i]=b,y;f(p+y,p,b);f(y,p,b) while 1:n=int(input());c=[(9,)]*999;f(1,1,0);print(c[0][1])
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page