# Displaying a telescoping series [duplicate]

This question already has an answer here:

I'd like to show my students what happens with the telescoping series $\sum_{n=1}^\infty\left[\frac{1}{n}-\frac{1}{n+1}\right]$. For example, I would like to display the partial sum: $$s_5=\left[1-\frac12\right]+\left[\frac12-\frac13\right]+\left[\frac13-\frac14\right]+\left[\frac14-\frac15\right]+\left[\frac15-\frac16\right]$$ I've not used HoldForm before, but I tried:

Table[HoldForm[1/n - 1/(n + 1)], {n, 1, 5}]


But that didn't work. Any suggestions?

## marked as duplicate by Kuba♦Feb 22 '17 at 6:45

• Far from perfect, but a bit better : show[n_?NumericQ] := Defer[1/n - 1/(n + 1)]; Table[show[n], {n, 5}] outputs {1 1/1 - 1/(1 + 1), 1/2 - 1/(2 + 1), 1/3 - 1/(3 + 1), 1/4 - 1/(4 + 1), 1/5 - 1/(5 + 1)}. – anderstood Feb 21 '17 at 16:58
• Or, better, this show[n_?NumericQ] := Block[{m = n + 1}, Inactivate[1/n - 1/m, Plus]]: – anderstood Feb 21 '17 at 18:30
• Do you think it is a valid duplicate: Getting terms and only evaluate specific parts? – Kuba Feb 21 '17 at 20:09
• Related: 110532 – Edmund Feb 21 '17 at 22:12
• I'd like to thank all my colleagues for tremendous help. There is a lot to learn here and some great examples to share with my students. – David Feb 22 '17 at 7:28

In the following way you can get the printed result you are asking for:

lst=Table[1/n, {n, 1,6}];
Inactive[Plus] @@ MapThread[Defer[Subtract[##]]& ,{Most[lst], Rest[lst]}] Here is another, simpler, solution:

HoldForm[1 - 1/2] + Sum[With[{n = n, m = n + 1}, HoldForm[1/n - 1/m]], {n, 2, 5}]


When we would have started the summation with n=1 instead of n=2, the very first number 1/1 would have turned up as 1*1/1, which is not what we want. Compare this question. An acceptable output is given by:

Sum[With[{n=n, m=n+1}, HoldForm[Divide[1,n]-Divide[1,m]]], {n,1,5}]

• @egwene sedai. Many thanks for including the output! – Fred Simons Feb 21 '17 at 18:57
• I think you need to make two edits, as in: Sum[With[{n=n,m=n+1},HoldForm[Divide[1,n]-Divide[1,m]]],{n,1,5}] and HoldForm[1 - 1/2] + Sum[With[{n = n,m = n + 1}, HoldForm[1/n - 1/m]], {n, 2, 5}]. Awesome answer. – David Mar 15 '17 at 4:45
• @David. You are right that I do not need the three arguments form of With. So I edited my answer accordingly.. – Fred Simons Mar 15 '17 at 7:59

Here's a start, first by inactivating Plus everywhere, then reactivating it in the denominators:

ReplaceAll[
Block[{Plus = Inactive[Plus]}, Sum[1/i - 1/(i + 1), {i, 1, 5}]],
-Inactive[Plus][v__]^(-1) :> -Plus[v]^(-1)
] • Simpler is Inactivate[Sum[1/i - 1/(i+1), {i, 5}], Plus] although it isn't equivalent because Sum produces an active Plus. – Carl Woll Feb 21 '17 at 17:13
• @CarlWoll It is simpler to write, but the result gets reordered when I use Inactivate. I do not fully understand why, but I wanted to retain the ordering shown in OP. – MarcoB Feb 21 '17 at 17:16
d = Table[If[n == 1, 1, 1/ToString[n]] - 1/ToString[n + 1], {n, 1, 5}];
s = "[" <> ToString[d[], StandardForm] <> "]";

For[ii = 2, ii <= Length[d], ii++,
s = s <> "+[" <> ToString[d[[ii]], StandardForm] <> "]";
] 