To understand the problem consider the following cases.
i)
If we buy 1 packet of pencils, and 2 packet of erasers,
we have 1*10=10 pencils and 2*6=12 erasers.
ii)
If we buy 3 packet of pencils, and 4 packet of erasers,
we have 3*10=30 pencils and 4*6=24 erasers.
So let
a and
b be the correct number of packets of pencils and erasers respectively.
That is the least numbers
a and
b, such that 10a=6b.
10a=6b
divide both sides by 10:

divide both sides by b:

the ratio a:b cannot be simplified any further. This means that the smallest (natural) numbers a and b such that

are a=3 and b=5
Answer:
3 packages of pencils, 5 packages of erasers.