To find the smallest number of eggs and muffins that can be purchased in order to have the same number, we need to find the least common multiple (LCM) of 18 and 8.
First, let's list the multiples of 18: 18, 36, 54, 72, 90, 108, ...
Next, let's list the multiples of 8: 8, 16, 24, 32, 40, 48, 56, 64, 72, ...
From these lists, we can see that the smallest number that appears in both lists is 72.
Therefore, if you want to have the same number of eggs and muffins, you would need to purchase 72 eggs (4 packages of 18 eggs) and 72 muffins (9 packages of 8 muffins).
Answer: The smallest number of eggs and muffins that can be purchased in order to have the same number of eggs and muffins is 72.