Vincent bought a few books at an average price of $20 each. When he bought another bag which cost $59, the average price of all the books and the bag became $23. How many books did Vincent buy?

Let's assume Vincent bought $x$ books.

The total cost of the books is $20x.
After buying the bag, the total cost of the bag and books is $20x+59.
The average price of all the books and the bag is $23.
According to the information above, the equation is $\frac{20x+59}{x+1}=23$.
The equation can be rewritten as $20x+59=23(x+1)$.
Multiplying out the brackets gives $20x+59=23x+23$.
Subtracting 20x and 23 from both sides gives $36=3x$.
Thus, $x=\frac{36}{3}=12$.
Therefore, Vincent bought a total of 12 books. Answer: \boxed{12}.

Let's solve this step-by-step:

Let's say Vincent bought x books.

The total cost of the books would be 20x.

After buying another bag which cost $59, the total cost of all the books and the bag became 20x + 59.

The average price of all the books and the bag is given as $23.

We can set up the following equation:

(20x + 59) / (x + 1) = 23

Now let's solve this equation:

20x + 59 = 23(x + 1)

20x + 59 = 23x + 23

20x - 23x = 23 - 59

-3x = -36

Dividing both sides by -3:
x = (-36) / (-3) = 12

So, Vincent bought 12 books.