# how is better to dof(x)=1-x ; f(f(1))+..+f(f(101)) i don't think that i have to calculate 101 terms...it's tricky

*print*Print*list*Cite

You need to evaluate `f(f(x))` replacing the equation of `f(x)` for `x` such that:

`f(f(x)) = 1 - f(x) => f(f(x)) = 1 - (1 - x) => f(f(x)) = x`Reasoning by analogy yields:

`f(f(1)) + f(f(2)) + .... + f(f(101)) = 1 + 2 + ... + 101`

You need to evaluate the summation using the following formula, such that:

`1 + 2 + ... + n = (n(n + 1))/2`

`sum_(n=1)^101 n = (101*(101 + 1))/2`

`sum_(n=1)^101 n = 51*101 =>sum_(n=1)^101 n = 5151`

**Hence, evaluating the given summation yields **`sum_(n=1)^101 n = 5151.`

Of course you won't calculate 101 terms!

We'll substitute x by the values f(1),...,f(101) to calculate the sum.

We'll try to calculate a general term:

f(f(k))=1-f(k)

f(f(k)) = 1-(1-k)

f(f(k)) = 1-1+k

We'll combine like terms:

f(f(k)) = k

We'll put k =1 up to k = 101.

Sum (k) = 1 + 2 + ... + 101

This is the sum of the first 101 natural terms:

Sum (k) = (1+101)*101/2

Sum (k) = 102*101/2

Sum (k) = 51*101

Sum (k) = 5151

f(f(1))+..+f(f(101)) = 5151