To determine the unit price (price per pencil) in each pack of pencils, we shall use the following;

For brand A, the unit price is;

For brand B, the unit price is;

If you decided to buy per unit rather than per pack, then the better option is Brand A which costs $0.27 each.
ANSWER:
Unit price for Brand A = $0.27 for each pencil
Unit price for Brand B = $0.32 for each pencil
The better buy is Brand A