A pencil cost $2. A pen cost $4. David paid $20 for 6 such pens and pencils. How many pens did he buy? How many pencils did he buy?
p = pen cost 4p
n = pencil = 6-p cost = 2(6-p) summed = 20
4p + 2(6-p) = 20
p = 4 then n = 2