This exercise is solved by finding the least common multiple between 10 and 8.
In fact, you have to buy a certain number of hot dog package, and you will have hot dogs, since there are 10 hot dogs in each package. The key concept here is that the number of hot dogs you have in the end is a multiple of the number of hot dogs in each box.
Similarly, you have to buy a certain number of hot dog buns package, and you will have hot dogs, since there are 8 hot dog buns in each package. Again, the key concept here is that the number of hot dog buns you have in the end is a multiple of the number of hot dog buns in each box.
Then, you want to have the same number of hot dogs and hot dog buns, i.e. you want
but you also want and to be the first values to satisfy this equation.
This means that you want a multiple of 10 to equal a multiple of 8, and you want the smallest possible number which does the trick. Again, this is exactly the definition of the least common multiple.
To find the least common multiple of two numbers, find their prime factorization, and collect all the primes from both factorizations, with the highest exponent possible. Since and , the primes appearing are 2 and 5. The higher exponent for 2 is 3, and the only exponent for 5 is 1. So, the answer is .
So, if you buy 4 packages of hot dogs and 5 packages of hot dog buns, you will have 40 hot dogs and 40 hot dog buns, as requested.