# How do I sum up p items in a sequence?

I have the following sequence

list = {p1, p2, p3, p4 ....}

I am summing up the p items as follows:

p1 + p2 + 2*sqrt (p21*p2) = p12

p12 + p3 + 2*sqrt (p12*p3) = p123

p123 + p4 + 2*sqrt (p123*p4) = p1234

How do I get the end result to be an addition of p12 + p123 + p1234 ?

-
Have a look at NestList. –  b.gatessucks Jun 24 '14 at 8:42

Fold[#1 + #2 + 2*Sqrt[#1*#2] &, First[list], Rest[list]]

Total@Rest@FoldList[#1 + #2 + 2*Sqrt[1 ##] &, First[list], Rest[list]]