Sum of square root of $n$ primes as a nested square root $$\sqrt{2}+\sqrt{3}=\sqrt{5+\sqrt{24}}$$
$$\sqrt{2}+\sqrt{3}+\sqrt{5}=\sqrt{14+\sqrt{140+\sqrt{4096+\sqrt{8847360}}}}$$
These are two examples of how sum of k square root of primes (not necessarily consecutive) can be represented as nested square roots. 
Is there any way to find all the terms of the nested roots given a set of primes? How do I compute them, individually?
i.e given $$A = [2, 3, 5]$$ representing $$\sqrt{2}+\sqrt{3}+\sqrt{5}$$
how do I get $$B = [14,140, 4096, 8847360]$$ representing $$\sqrt{14+\sqrt{140+\sqrt{4096+\sqrt{8847360}}}}$$
The above are just examples, how do I compute for an arbitrary number of primes? What if the primes are given as 
$$A = [a_0, a_1, ..., a_n]$$  How can I compute the nested loop?

The first it's just 
$$\sqrt{p}+\sqrt{q}=\sqrt{p+q+2\sqrt{pq}}=\sqrt{p+q+\sqrt{4pq}}.$$
For the second and for the rest maybe the following would help.
$$\sqrt2+\sqrt3+\sqrt5=\sqrt{10+2(\sqrt{6}+\sqrt{10}+\sqrt{15})}=$$
$$=\sqrt{14+2(\sqrt{6}+\sqrt{10}+\sqrt{15}-2)}=$$
$$=\sqrt{14+2\sqrt{35+2\sqrt{10}+6\sqrt6}}=$$
$$=\sqrt{14+2\sqrt{35+2\sqrt{\left(\sqrt{10}+3\sqrt{6}\right)^2}}}=$$
$$=\sqrt{14+2\sqrt{35+4\sqrt{16+3\sqrt{15}}}}=$$
$$=\sqrt{14+\sqrt{140+\sqrt{4096+\sqrt{8847360}}}}.$$
