A shopkeeper bought a box of pens. There were fewer than 60 pens in the box. The pens can be packed into bags of 4 or 7. What is the greatest possible number of pens in the box?

To find the greatest possible number of pens in the box, we can start by checking for the highest number of pens that can be packed into bags of 7. We divide the total number of pens by 7 and take the whole number part of the quotient.

Let's assume the number of pens in the box is x.
x = 7a (where a is a whole number)

Now, since there were fewer than 60 pens in the box, we know that x < 60.

If we divide 60 by 7, we get 8 with a remainder of 4. This means we can have a maximum of 8 bags of 7 pens, which is a total of 56 pens (7 x 8 = 56).

However, since we want to find the greatest possible number of pens, we need to check if we can pack any more pens into bags of 4.

Let's divide the remaining pens (60 - 56 = 4) by 4 to see how many bags of 4 we can add.

4 / 4 = 1

So, we can add 1 bag of 4 pens.

Therefore, the greatest possible number of pens in the box is 56 + 4 = 60.