Given integers a, b and c, I am trying to find n<=b−1 such that this inequality holds : sum_(i=0)^(n)(a)/(b - i) <= c <= sum_(i=0)^(n+1)(a)/(b-i) That is to say : the largest n up to which the sum is the closest to c . Since : sum_(i=0)^(n)(a)/(b-i)=a*(sum_(i=0)^(b)(1)/(i)-sum_(i=0)^(b-n-1)(1)/(i)) And sum_(i=0)^k 1/i=H_k where H_k is the k-th harmonic number, We can rewrite the inequality into : a(H_b−H_(b−n−1))<=c<=a(H_b−H_(b−n−2)) How to find a tight lower and upper bound for n, such that this inequality holds ?

Aleah Booth

Aleah Booth

Answered question

2022-07-17

Inequality involving sum with parameter in denominator (leading to harmonic number problem)
Given integers a, b and c, I am trying to find n b 1 such that this inequality holds :
i = 0 n a b i c i = 0 n + 1 a b i
That is to say : the largest n up to which the sum is the closest to c
Since :
i = 0 n a b i = a ( i = 0 b 1 i i = 0 b n 1 1 i )
And i = 0 k 1 i = H k where H k is the k-th harmonic number,
We can rewrite the inequality into :
a ( H b H b n 1 ) c a ( H b H b n 2 )
How to find a tight lower and upper bound for n, such that this inequality holds ?

Answer & Explanation

agyalapi60

agyalapi60

Beginner2022-07-18Added 17 answers

Let us rewrite the inequality as
S n c a S n + 1 ,
where S n = 1 b i = 0 n f ( i b ) and f is defined by x 1 1 x for x in [ 0 , 1 [. Thus, one can view S n as the rectangle method of numerical integration applied to f. Since f is strictly increasing, one has
1 b f ( i b ) < i / b ( i + 1 ) / b f ( x ) d x < 1 b f ( i + 1 b ) .
By summation over i, one obtains for all n
S n < 0 ( n + 1 ) / b f ( x ) d x I n + 1 < S n + 1 S 0 < S n + 1 ,
where the integral is given by I n + 1 = ln ( 1 n + 1 b ). Let us examine two cases:
if c / a is larger than S b 1 , then no such n can be found. Taking n = b 1 insures S n c / a only.
else, we can find n such that the first inequality is satisfied. If S n c / a < I n + 1 , then I n < c / a < I n + 1 . Therefore,
n = b ( 1 exp ( c a ) ) ,
where denotes the floor function. Otherwise, I n + 1 c / a S n + 1 , and
n = b ( 1 exp ( c a ) ) 1 .

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?