This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A304879 #11 Jan 09 2024 13:09:56 %S A304879 1,10,6,7,8,2,9,3,4,7,21,19,26,95,37,62,58,6,40,27,41,39,93,71,17,53, %T A304879 98,83,40,7,61,59,73,83,98,84,76,63,8,96,81,79,53,87,85,92,90,43,40, %U A304879 68,2,99,33,99,71,11,9,23,40,94,42,38,13,99,74,31,29,3,40 %N A304879 a(n) = denominator(min{r with r in R}) and R = {0 <= r rational <= 1 and [r*k] = n}. Here k = 10^(floor(log_10(n))+1) and [x] = floor(x+1/2) + ceiling((2*x-1)/4) - floor((2*x-1)/4) - 1. %C A304879 a(n) is the denominator of the smallest nonnegative fraction r such that round(10^d*r) = n, where d is the number of digits of n and Gaussian rounding (round half to even) is applied. %e A304879 The table below shows the different rational numbers which satisfy the requirements of the definition except minimality. The denominators of the first rational number in each row constitute the sequence. Note that the round function is not implemented uniformly in popular software. For example, Mathematica matches our definition, while Maple's round function would return incorrect values. %e A304879 . %e A304879 n | rational numbers decimal value rounded(10*r) %e A304879 ----+--------------------------------------------------- %e A304879 0 | 0/1, .0000000000, 0 %e A304879 1 | 1/10, 1/9, 1/8, 1/7, .1000000000, 1 %e A304879 2 | 1/6, 1/5, 2/9, 1/4, .1666666667, 2 %e A304879 3 | 2/7, 3/10, 1/3, .2857142857, 3 %e A304879 4 | 3/8, 2/5, 3/7, 4/9, .3750000000, 4 %e A304879 5 | 1/2, .5000000000, 5 %e A304879 6 | 5/9, 4/7, 3/5, 5/8, .5555555556, 6 %e A304879 7 | 2/3, 7/10, 5/7, .6666666667, 7 %e A304879 8 | 3/4, 7/9, 4/5, 5/6, .7500000000, 8 %e A304879 9 | 6/7, 7/8, 8/9, 9/10, .8571428571, 9 %p A304879 r := proc(n) local nint, k, p, q, S; k := 10^(ilog10(n)+1); %p A304879 nint := m -> floor(m + 1/2) + ceil((2*m-1)/4) - floor((2*m-1)/4) - 1; %p A304879 if n = 0 then return 0/1 fi; S := NULL; %p A304879 for p from 1 to k do for q from p+1 to k do %p A304879 if nint(p*k/q) = n then S := S,p/q fi %p A304879 od od; sort(convert({S}, list))[1] end: %p A304879 a := n -> denom(r(n)): seq(a(n), n=0..68); %Y A304879 Cf. A304880 (numerators), A303612. %K A304879 nonn,frac %O A304879 0,2 %A A304879 _Peter Luschny_, May 20 2018