Answer: Hello there!
You want to buy an equal number of pens and pencils, and the pencils come in packs of 9, and pens come in packs of 6.
So if you want to buy an equal number of them, we are looking for a multiple of 6 and 9.
But we want to know the minimum number of each item; then we need the minimal common multiple, or MCM,
The minimal common multiple between two numbers a and b is obtained as:
Where the MCF(a,b) is the maximal common factor between a and b.
Our numbers are 6 and 9 and is easy to see that the maximal common factor between these numbers is 3.
then the minimal common multiple between 6 and 9 is:
MCM = (6*9)/3 = 18
So the minimal quantity of each item you can buy is 18, which is equivalent to buy two packs of pencils or 3 packs of pens.