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.

A374856 a(n) is the least integer m such that the distance of x_m from its nearest integer is less than 1/n, where x_m is the m-th extrema of Gamma(x).

This page as a plain text file.
%I A374856 #59 Jul 12 2025 10:30:49
%S A374856 0,1,6,23,76,231,681,1968,5605,15817,44324,123573,343157,950000,
%T A374856 2623530,7230746,19896140,54671729,150058028,411465352,1127315946,
%U A374856 3086355718,8444524052,23092305853,63117665557,172444844373,470961842866,1285804853026,3509404275438,9575773901601
%N A374856 a(n) is the least integer m such that the distance of x_m from its nearest integer is less than 1/n, where x_m is the m-th extrema of Gamma(x).
%C A374856 a(n) approximately equals exp(Pi/tan(Pi/n)).
%H A374856 Wikipedia, <a href="https://en.wikipedia.org/wiki/Gamma_function#Minima_and_maxima">Gamma Extrema</a>
%H A374856 Wikipedia, <a href="https://en.wikipedia.org/wiki/Digamma_function#Roots_of_the_digamma_function">Digamma Roots</a>
%F A374856 A385170(a(n)) = n.
%e A374856  -1 + 1.46163214496836 < 1/1
%e A374856   1 - 0.50408300826446 < 1/2
%e A374856   6 - 5.66716244155689 < 1/3
%e A374856  23 - 22.7502429843061 < 1/4
%e A374856  76 - 75.8003723367285 < 1/5
%e A374856 231 - 230.833395691244 < 1/6
%o A374856 (Python)
%o A374856 from gmpy2 import mpq, get_context, exp, digamma, sign, is_nan, RoundUp, RoundDown
%o A374856 def apply_on_interval(func, interval):
%o A374856     ctx.round = RoundUp
%o A374856     rounded_up = func(interval[0])
%o A374856     ctx.round = RoundDown
%o A374856     rounded_down = func(interval[1])
%o A374856     return rounded_down, rounded_up
%o A374856 def digamma_sign_near_int(i, f):
%o A374856     while True:
%o A374856         d, u = apply_on_interval(lambda x: digamma(i + 1/x), [f, f])
%o A374856         if not(is_nan(d)) and not(is_nan(u)) and (sign(d) == sign(u)):  return sign(d)
%o A374856         ctx.precision += 1
%o A374856 def find_next_zero_crossing(f, i, growth_factor):  # Bisect.
%o A374856     lo, hi = int(i * const_e), int(i * growth_factor)
%o A374856     while lo - 1 != hi:
%o A374856         if digamma_sign_near_int(mid := (hi + lo) // 2, f) == -1:  lo = mid
%o A374856         else:  hi = mid
%o A374856     return hi
%o A374856 def generate_sequence(n):
%o A374856     seq, frac_denoms = [0, 1, 6], (mpq(str(i)) for i in range(4, n + 1))
%o A374856     for f in frac_denoms:  seq.append(-find_next_zero_crossing(f, -seq[-1], seq[-1] / seq[-2]))
%o A374856     return seq
%o A374856 const_e, ctx = exp(1), get_context()
%o A374856 ctx.precision = 2
%o A374856 A374856 = generate_sequence(30)
%Y A374856 Cf. A030169, A175472, A175473, A377506, A385170.
%K A374856 nonn
%O A374856 1,3
%A A374856 _Jwalin Bhatt_, Sep 16 2024