I don't understand how to do these problems, could you please post the solutions?

18. Less than forty identical small balls can be arranged to form a square. These balls can also be arranged to form an equilateral triangle. Find the number of small balls.

Ans. 36

29. Find a point P that is on the same plane as the equilateral triangle ABC such that PAB, PAC, and PBC are all isosceles triangles. How many possible such points of P are there?

ans. 130

21. As shown in the figure, Both ABCD and CEFG are squares. Connect AG and AG meets CE at H. Connect HF. Find the shaded area.

ans. 32