Assume all three circles have the same radius, r. Draw a 3 circle stack with the bottom two circles separated by a distance 2d. Draw a triangle connecting the centers of the 3 circles. Drop an altitude from the center of the top circle to the base of the triangle (connecting the centers of the bottom two circles). The altitude forms a right angle with the base of the triangle. Call the height of the altitude h. By the Pythagorean Theorem:
(2r)2 - (r+d)2 = h2
When d = 0, h2 = 3r2. When d=r, then h=0 and the top circle is no longer stacked. When d>r, then h2 is negative so there is no solution beyond d = r (because the circles are no longer stacked). The height of the stack, when d ≤ r, is:
height = h + 2r