A triangle with sides 6, 12, and 18 is similar to another triangle whose longest side is 24. What is the perimeter of the larger triangle?