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 A303612 #76 Feb 16 2025 08:33:54 %S A303612 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 A303612 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 A303612 15,13,11,9,7,12,17,5,18,8,19,11,17,29,3,19,13,10 %N A303612 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 A303612 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 A303612 a(k-n) = a(n), where k is the first power of 10 exceeding n. %C A303612 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 A303612 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 A303612 C. F. Gauss, Theorematis arithmetici demonstratio nova, Societati regiae scientiarum Gottingensis, Vol. XVI., January 15, 1808, pp. 5-7, section 4-5. %D A303612 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 A303612 Kenneth E. Iverson, A Programming Language, John Wiley And Sons, Inc., 1962 (4th printing 1967), pp. 11-12. %D A303612 Takeo Kamizawa, Note on the Distance to the Nearest Integer, Faculty of Physics, Astronomy and Informatics, Nicolaus Copernicus University, Toruń, Poland, 2016. %D A303612 A. M. Legendre, Théorie des nombres (deuxième édition), 1808. %D A303612 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 A303612 Luca Petrone, <a href="/A303612/b303612.txt">Table of n, a(n) for n = 0..9999</a> %H A303612 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 A303612 Luca Petrone, <a href="/A303612/a303612.pdf">log-log plot for first 100000 terms</a> %H A303612 Š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 A303612 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/NearestIntegerFunction.html">Nearest Integer Function</a> %H A303612 Wikipedia, <a href="https://en.wikipedia.org/wiki/Nearest_integer_function">Nearest integer function</a> %e A303612 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 A303612 . %e A303612 | | decimal | round(10*r) %e A303612 n | rational numbers r | value | Mathematica | Maple %e A303612 --+---------------------+-----------+-------------+------ %e A303612 0 | 0/1 | 0.0000000 | 0 | 0 %e A303612 1 | 1/7, 1/8, 1/9, 1/10 | 0.1428571 | 1 | 1 %e A303612 2 | 1/4, 1/5, 1/6, 2/9 | 0.2500000 | 2 | * 3 * %e A303612 3 | 1/3, 2/7, 3/10 | 0.3333333 | 3 | 3 %e A303612 4 | 2/5, 3/7, 3/8, 4/9 | 0.4000000 | 4 | 4 %e A303612 5 | 1/2 | 0.5000000 | 5 | 5 %e A303612 6 | 3/5, 4/7, 5/8, 5/9 | 0.6000000 | 6 | 6 %e A303612 7 | 2/3, 5/7, 7/10 | 0.6666667 | 7 | 7 %e A303612 8 | 3/4, 4/5, 5/6, 7/9 | 0.7500000 | 8 | 8 %e A303612 9 | 6/7, 7/8, 8/9, 9/10 | 0.8571429 | 9 | 9 %p A303612 r := proc(n) local nint, k, p, q; k := 10^(ilog10(n)+1); %p A303612 nint := m -> floor(m + 1/2) + ceil((2*m-1)/4) - floor((2*m-1)/4) - 1; %p A303612 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 A303612 a := n -> denom(r(n)): seq(a(n), n=0..99); # _Peter Luschny_, May 19 2018 %t A303612 a = {1}; %t A303612 For[i = 1, i <= 100, i++, %t A303612 nmax = 10^(Floor[Log[10, i]] + 1); %t A303612 r = i/nmax; %t A303612 For[n = 1, n <= nmax, n++, %t A303612 If[Round[Round[n r]/n, 1/nmax] == r, %t A303612 a = Flatten[Append[a, n]]; %t A303612 Break[]; %t A303612 ]]] %Y A303612 Cf. A239525, A297367, A006842, A006843, A304879. %K A303612 nonn,base,frac,easy %O A303612 0,2 %A A303612 _Luca Petrone_, Apr 27 2018