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.
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, 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, 15, 13, 11, 9, 7, 12, 17, 5, 18, 8, 19, 11, 17, 29, 3, 19, 13, 10
Offset: 0
Examples
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. . | | decimal | round(10*r) n | rational numbers r | value | Mathematica | Maple --+---------------------+-----------+-------------+------ 0 | 0/1 | 0.0000000 | 0 | 0 1 | 1/7, 1/8, 1/9, 1/10 | 0.1428571 | 1 | 1 2 | 1/4, 1/5, 1/6, 2/9 | 0.2500000 | 2 | * 3 * 3 | 1/3, 2/7, 3/10 | 0.3333333 | 3 | 3 4 | 2/5, 3/7, 3/8, 4/9 | 0.4000000 | 4 | 4 5 | 1/2 | 0.5000000 | 5 | 5 6 | 3/5, 4/7, 5/8, 5/9 | 0.6000000 | 6 | 6 7 | 2/3, 5/7, 7/10 | 0.6666667 | 7 | 7 8 | 3/4, 4/5, 5/6, 7/9 | 0.7500000 | 8 | 8 9 | 6/7, 7/8, 8/9, 9/10 | 0.8571429 | 9 | 9
References
- C. F. Gauss, Theorematis arithmetici demonstratio nova, Societati regiae scientiarum Gottingensis, Vol. XVI., January 15, 1808, pp. 5-7, section 4-5.
- 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.
- Kenneth E. Iverson, A Programming Language, John Wiley And Sons, Inc., 1962 (4th printing 1967), pp. 11-12.
- Takeo Kamizawa, Note on the Distance to the Nearest Integer, Faculty of Physics, Astronomy and Informatics, Nicolaus Copernicus University, Toruń, Poland, 2016.
- A. M. Legendre, Théorie des nombres (deuxième édition), 1808.
- 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.
Links
- Luca Petrone, Table of n, a(n) for n = 0..9999
- IEEE, 754-2008 - IEEE Standard for Floating-Point Arithmetic, IEEE Computer Society, August 28, 2008.
- Luca Petrone, log-log plot for first 100000 terms
- Štefan Porubský, Integer rounding functions, Interactive Information Portal for Algorithmic Mathematics, Institute of Computer Science of the Czech Academy of Sciences, April 1, 2007.
- Eric Weisstein's World of Mathematics, Nearest Integer Function
- Wikipedia, Nearest integer function
Programs
-
Maple
r := proc(n) local nint, k, p, q; k := 10^(ilog10(n)+1); nint := m -> floor(m + 1/2) + ceil((2*m-1)/4) - floor((2*m-1)/4) - 1; 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: a := n -> denom(r(n)): seq(a(n), n=0..99); # Peter Luschny, May 19 2018
-
Mathematica
a = {1}; For[i = 1, i <= 100, i++, nmax = 10^(Floor[Log[10, i]] + 1); r = i/nmax; For[n = 1, n <= nmax, n++, If[Round[Round[n r]/n, 1/nmax] == r, a = Flatten[Append[a, n]]; Break[]; ]]]
Comments