Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #75 Jan 09 2024 13:09:24
%S 1,7,4,3,5,2,5,3,4,7,10,9,8,15,7,13,19,6,11,16,5,14,9,13,17,4,19,11,
%T 18,7,10,13,19,3,29,17,11,19,8,18,5,17,12,7,9,11,13,15,21,35,2,35,21,
%U 15,13,11,9,7,12,17,5,18,8,19,11,17,29,3,19,13,10
%N a(n) = min{denominator(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 a(n) is the smallest denominator of a fraction that, when rounded to d digits after the decimal point, is equal to 0.n, where d is the number of digits of n, and the rounding convention applied is that a number whose fractional part is 1/2 is rounded to the nearest even integer.
%C a(k-n) = a(n), where k is the first power of 10 exceeding n.
%C The sequence [A297367(n)/a(n), n = 10^(k-1)..10^(k)-1] is a subsequence of the Farey sequence A006842/A006843 of order ceiling((2/3)*10^k). For example, the terms a(1)..a(9) are the denominators of {1/7, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 6/7}; this sequence of fractions is a subsequence of the Farey sequence of order ceiling((2/3)*10^1) = 7, i.e., F7 = {0/1, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 2/5, 3/7, 1/2, 4/7, 3/5, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 1/1}.
%C With the exception of n in {1, 2, 4, 13, 16}, r(n) = A297367(n)/a(n) is in the Farey series of order n (row n of A006842/A006843). - _Peter Luschny_, May 19 2018
%D C. F. Gauss, Theorematis arithmetici demonstratio nova, Societati regiae scientiarum Gottingensis, Vol. XVI., January 15, 1808, pp. 5-7, section 4-5.
%D L. Graham and Donald E. Knuth and Oren Patashnik, Concrete mathematics: a foundation for computer science (Second Edition), Addison-Wesley Publishing Company, 1994, pp. 86-101.
%D Kenneth E. Iverson, A Programming Language, John Wiley And Sons, Inc., 1962 (4th printing 1967), pp. 11-12.
%D Takeo Kamizawa, Note on the Distance to the Nearest Integer, Faculty of Physics, Astronomy and Informatics, Nicolaus Copernicus University, Toruń, Poland, 2016.
%D A. M. Legendre, Théorie des nombres (deuxième édition), 1808.
%D D. Zuras, M. Cowlishaw, R. M. Grow, et al., IEEE Standard for Floating-Point Arithmetic, Std 754(tm)-2008, ISBN 978-0-7381-5753-5, August 28, 2008, p. 16, sections 4.3.1-4.3.3.
%H Luca Petrone, <a href="/A303612/b303612.txt">Table of n, a(n) for n = 0..9999</a>
%H IEEE, <a href="https://ieeexplore.ieee.org/servlet/opac?punumber=4610933">754-2008 - IEEE Standard for Floating-Point Arithmetic</a>, IEEE Computer Society, August 28, 2008.
%H Luca Petrone, <a href="/A303612/a303612.pdf">log-log plot for first 100000 terms</a>
%H Štefan Porubský, <a href="http://www.cs.cas.cz/portal/AlgoMath/NumberTheory/ArithmeticFunctions/IntegerRoundingFunctions.htm">Integer rounding functions</a>, Interactive Information Portal for Algorithmic Mathematics, Institute of Computer Science of the Czech Academy of Sciences, April 1, 2007.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/NearestIntegerFunction.html">Nearest Integer Function</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Nearest_integer_function">Nearest integer function</a>
%e The table below shows the different rational numbers which satisfy the requirements of the definition. 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 .
%e | | decimal | round(10*r)
%e n | rational numbers r | value | Mathematica | Maple
%e --+---------------------+-----------+-------------+------
%e 0 | 0/1 | 0.0000000 | 0 | 0
%e 1 | 1/7, 1/8, 1/9, 1/10 | 0.1428571 | 1 | 1
%e 2 | 1/4, 1/5, 1/6, 2/9 | 0.2500000 | 2 | * 3 *
%e 3 | 1/3, 2/7, 3/10 | 0.3333333 | 3 | 3
%e 4 | 2/5, 3/7, 3/8, 4/9 | 0.4000000 | 4 | 4
%e 5 | 1/2 | 0.5000000 | 5 | 5
%e 6 | 3/5, 4/7, 5/8, 5/9 | 0.6000000 | 6 | 6
%e 7 | 2/3, 5/7, 7/10 | 0.6666667 | 7 | 7
%e 8 | 3/4, 4/5, 5/6, 7/9 | 0.7500000 | 8 | 8
%e 9 | 6/7, 7/8, 8/9, 9/10 | 0.8571429 | 9 | 9
%p r := proc(n) local nint, k, p, q; k := 10^(ilog10(n)+1);
%p nint := m -> floor(m + 1/2) + ceil((2*m-1)/4) - floor((2*m-1)/4) - 1;
%p for p from 1 to k do for q from p+1 to k do if nint(p*k/q) = n then return p/q fi od od; 0/1 end:
%p a := n -> denom(r(n)): seq(a(n), n=0..99); # _Peter Luschny_, May 19 2018
%t a = {1};
%t For[i = 1, i <= 100, i++,
%t nmax = 10^(Floor[Log[10, i]] + 1);
%t r = i/nmax;
%t For[n = 1, n <= nmax, n++,
%t If[Round[Round[n r]/n, 1/nmax] == r,
%t a = Flatten[Append[a, n]];
%t Break[];
%t ]]]
%Y Cf. A239525, A297367, A006842, A006843, A304879.
%K nonn,base,frac,easy
%O 0,2
%A _Luca Petrone_, Apr 27 2018