cp's OEIS Frontend

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.

Showing 1-2 of 2 results.

A297367 Numerators of fraction whose denominator is defined in A303612.

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 3, 2, 3, 6, 1, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 3, 2, 3, 4, 1, 5, 3, 5, 2, 3, 4, 6, 1, 10, 6, 4, 7, 3, 7, 2, 7, 5, 3, 4, 5, 6, 7, 10, 17, 1, 18, 11, 8, 7, 6, 5, 4, 7, 10, 3, 11, 5, 12, 7, 11, 19, 2, 13, 9, 7, 5, 13, 8, 14, 3, 13, 10, 7, 11, 4
Offset: 0

Views

Author

Luca Petrone, Apr 30 2018

Keywords

Crossrefs

Cf. A303612.

Programs

  • Maple
    # The function r is defined in A303612.
    a := n -> numer(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, Round[n r]]];
    Break[];
    ]]]

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.

Original entry on oeis.org

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, 98, 83, 40, 7, 61, 59, 73, 83, 98, 84, 76, 63, 8, 96, 81, 79, 53, 87, 85, 92, 90, 43, 40, 68, 2, 99, 33, 99, 71, 11, 9, 23, 40, 94, 42, 38, 13, 99, 74, 31, 29, 3, 40
Offset: 0

Views

Author

Peter Luschny, May 20 2018

Keywords

Comments

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.

Examples

			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.
.
  n | rational numbers       decimal value   rounded(10*r)
----+---------------------------------------------------
  0 | 0/1,                   .0000000000,         0
  1 | 1/10, 1/9, 1/8, 1/7,   .1000000000,         1
  2 | 1/6, 1/5, 2/9, 1/4,    .1666666667,         2
  3 | 2/7, 3/10, 1/3,        .2857142857,         3
  4 | 3/8, 2/5, 3/7, 4/9,    .3750000000,         4
  5 | 1/2,                   .5000000000,         5
  6 | 5/9, 4/7, 3/5, 5/8,    .5555555556,         6
  7 | 2/3, 7/10, 5/7,        .6666666667,         7
  8 | 3/4, 7/9, 4/5, 5/6,    .7500000000,         8
  9 | 6/7, 7/8, 8/9, 9/10,   .8571428571,         9
		

Crossrefs

Cf. A304880 (numerators), A303612.

Programs

  • Maple
    r := proc(n) local nint, k, p, q, S; k := 10^(ilog10(n)+1);
    nint := m -> floor(m + 1/2) +  ceil((2*m-1)/4) - floor((2*m-1)/4) - 1;
    if n = 0 then return 0/1 fi; S := NULL;
    for p from 1 to k do for q from p+1 to k do
        if nint(p*k/q) = n then S := S,p/q fi
    od od; sort(convert({S}, list))[1] end:
    a := n -> denom(r(n)): seq(a(n), n=0..68);
Showing 1-2 of 2 results.