login
Numerator of lexicographically least fraction f satisfying floor(f * 10^A055642(n)) = n.
2

%I #9 Apr 17 2016 04:41:21

%S 1,1,1,2,1,2,3,4,9,1,1,1,2,1,2,1,3,2,4,1,3,2,3,6,1,4,3,2,5,3,5,8,1,8,

%T 5,4,3,5,9,2,5,3,7,4,5,6,8,12,25,1,14,9,7,6,5,9,4,7,13,3,8,5,7,9,13,2,

%U 19,11,9,7,5,8,11,20,3,10,7,11,19,4,9,14,5

%N Numerator of lexicographically least fraction f satisfying floor(f * 10^A055642(n)) = n.

%C 1 <= a(n) <= n.

%C For any reduced fraction u/v in the interval [1/10..1[, a(floor(u/v*10^k))=u for k sufficiently large.

%H Paul Tek, <a href="/A224926/b224926.txt">Table of n, a(n) for n = 1..11000</a>

%e The fractions f satisfying floor(f*100)=42, are, in lexicographical order: 3/7, 6/14, 8/19, 9/21, 11/26, 12/28, 14/33, 15/35, 16/38, 17/40, 18/42, 19/45, 20/47, 21/49...

%e Hence, a(42)=numerator(3/7)=3.

%o (PARI) a224926(n) =\

%o local(a=0,b=1,c,d,e=1,f=0,x=1);\

%o while(x<=n, x=x*10);\

%o while(1, c=a+e;d=b+f;\

%o if(c/d < n/x, a=c;b=d,\

%o if(c/d >= (n+1)/x, e=c;f=d,\

%o return(c))))

%Y Cf. A224927 (denominators), A055642, A002487.

%K nonn,base,frac

%O 1,4

%A _Paul Tek_, Apr 20 2013