I=∫0π [cotx]dx where [·] denotes the greatest integer function, is equal to
-1
-π/2
π/2
1
I=∫0π [cotx]dx=∫0π/2 ([cotx]+[cot(π−x)])dx=∫0π/2 ([cotx]+[−cotx])dx
Put cotx=t, so that
I=∫0∞ [t]+[−t]dt1+t2=limn→∞ ∑k=1n ∫k−1k ([t]+[−t])dt1+t2
But [t]+[−t]=−1 for k−1<t<k, there fore
∫k−1k ([t]+[−t])dt1+t2=∫k−1k (−1)dt1+t2=tan−1k−tan−1(k−1)
∴ I=−limn→∞ ∑k=1n tan−1k−tan−1(k−1)
=−limn→∞ tan−1n−tan−10=−π2.