Answer: After 72 weeks they will be in the port at the same time.
Explanation:
Given, Total ships = 4
The first one leaves and comes back every 3 weeks, the second one every 9 weeks, the third one every 12 weeks, and the fourth every 24 weeks .
So, the number of weeks they will take to be in the port at the same time = L.C.M. (3, 9, 12 , 24) (L.C.M. = least common multiple)
Since, 9= 3 x 3
12 = 2 x2 x 3
24 = 2 x 2x 2 x3
then, L.C.M. (3, 9, 12 , 24)= 2 x 2x 2 x 3 x3 =72
Hence after 72 weeks they will be in the port at the same time.