# How do I calculate the integral of $\lfloor1/x\rfloor$ from $x=\frac{1}{n+2}$ to $x=\frac{1}{n}$?

How do I calculate integral : $$\int_{\frac{1}{n+2}}^{\frac{1}{n}}\lfloor1/x\rfloor dx$$ where $\lfloor t\rfloor$ means the integer part (I believe that's how it should be translated) or floor function of $t$.

Use the interpretation of the integral as the area under a curve between the limits of integration.

I assume here that $n$ is a positive integer.

Then $$\tfrac1{n+2}<x<\tfrac1{n+1} \implies n+1<\tfrac1x<n+2\implies[\tfrac1x]=n+1$$ and $$\tfrac1{n+1}<x<\tfrac1{n} \implies n<\tfrac1x<n+1\implies[\tfrac1x]=n$$

and these two intervals have width $$\tfrac1{n+1}-\tfrac1{n+2}=\tfrac1{(n+1)(n+2)}$$ and $$\tfrac1{n}-\tfrac1{n+1}=\tfrac1{n(n+1)}$$ respectively. The area is the sum of the areas of two rectangles: $$\int_{\frac1{n+2}}^{\frac1{n}} [\tfrac1x]\;dx=(n+1)\cdot\tfrac1{(n+1)(n+2)}+n\cdot\tfrac1{n(n+1)}$$ $$=\boxed{\tfrac1{n+2}+\tfrac1{n+1}}$$ (Note that the value of the integrand on the boundaries of these intervals doesn't affect the value of the integral, so we use strict inequality for convenience.)

Make the substitution $\frac{1}{x}=t$ then your integral turns into $$\int_n^{n+2}\frac{\lfloor t\rfloor}{t^2} dt$$ Now just split the integral into two intervals $n$ to $n+1$ and $n+1$ to $n+2$ assuming $n$ is an integer.

• Do you mean the given integral is equal to $\int_n^{n+2}\frac{1}{t^2}\lfloor t\rfloor dt$? – Olivier Oloa Jul 5 '17 at 18:30
• @OlivierOloa Yeah, thanks, strange nobody noticed it yet. – kingW3 Jul 5 '17 at 18:34
• This seems an unnecessary complication to me. You can already split the original integral into two intervals, and the orginal integrand is actually constant on each of them. With this change of variable, you now have to actually perform a nontrivial computation for each interval since the integrand is no longer constant. – MPW Jul 5 '17 at 19:02
• @MPW Yeah you're right, I initially wanted to post a solution similar to yours but thought that $\frac 1x$ might be throwing the OP off. – kingW3 Jul 5 '17 at 19:28

I think this should be possible,to solve by decomposing the integrale from $1/(n+2)$ to $1/(n+1)$ and so on. On each of these Integrals, your function should be constant.