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.

A385170 a(n) is the integer part of the reciprocal of the distance of x_n from its nearest integer, where x_n is the n-th extrema of gamma(x).

Original entry on oeis.org

1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
Offset: 0

Views

Author

Jwalin Bhatt, Jun 20 2025

Keywords

Comments

For n>=1, the nearest integer is -n and x_n drifts slowly towards it so that a(n) is a slowly increasing function of n.
a(n) = k occurs for the first time at n = A374856(k).
a(n) approximately equals floor(Pi/arctan(Pi/log(n))).
The corresponding gamma function value y_n = gamma(x_n) decreases in absolute value and A377506 captures its reciprocal (with a round).

Examples

			For n=10, x_10 = -9.702672... (A256687) and its nearest integer is -10 which is distance d = -9.702672... - (-10) = 0.297... away and a(n) = floor(1/d) = 3.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[
    {bounds, gammaExtrema, fractionalPart, intReci},
    bounds = {-n - 1 + 1/(n + 3), -n - 0.5};
    gammaExtrema = x /. FindRoot[PolyGamma[0, x + 1] == 0, {x, Sequence @@ bounds}];
    gammaExtrema = -Abs[gammaExtrema];
    fractionalPart = Mod[gammaExtrema, 1];
    Floor[1 / fractionalPart]
    ]
  • Python
    from gmpy2 import mpq, get_context, digamma, sign, is_nan, RoundUp, RoundDown
    def apply_on_interval(func, interval):
        ctx.round = RoundUp
        rounded_up = func(interval[0])
        ctx.round = RoundDown
        rounded_down = func(interval[1])
        return rounded_down, rounded_up
    def digamma_sign_near_int(i, f):
        while True:
            d, u = apply_on_interval(lambda x: digamma(i + 1/x), [f, f])
            sign_d = sign(d)
            if not(is_nan(d)) and not(is_nan(u)) and (sign_d == sign(u)):
                return sign_d
            ctx.precision += 1
    def generate_sequence(n):
        i, f, seq = -1, mpq('2'), [1]
        while len(seq) < n:
            if digamma_sign_near_int(i, f) != -1:
                f += 1
            seq.append(int(f)-1)
            i -= 1
        return seq
    ctx = get_context()
    ctx.precision = 2
    A385170 = generate_sequence(101)