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).
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
Keywords
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.
Links
- Jwalin Bhatt, Table of n, a(n) for n = 0..10000
- Wikipedia, Gamma Extrema
- Wikipedia, Digamma Roots
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)
Comments