I crunched the math on this, based on NPC starting wealth and the cost to scribe spells into the spellbook, and this is what I came up with:
Code:
From the RAW:
A wizard can also add a spell to her book whenever she encounters one
on a magic scroll or in another wizard's spellbook.
In most cases, wizards charge a fee for the privilege of copying spells
from their spellbooks. This fee is usually equal to the spell's level x 50 gp.
A spell takes up one page of the spellbook per spell level. Even a 0-level
spell (cantrip) takes one page. Materials for writing the spell cost
100 gp per page.
Also, starting NPC wealth is listed in the DMG and NPC's generally do not spend more than 1/3 of their starting wealth on a single item. That gives you how much money each NPC can spend on spells beyond what they get for free.
So, assuming the wizard goes with scrolls or borrowed books at each level depending on what is most economical, here is the cost for each "purchased" spell:
Code:
Spell Lvl Cost to Scribe (including source)
1 125
2 300
3 450
4 600
5 750
6 900
7 1050
8 1200
9 1350
Assuming the NPC spends no more than 1/3 of his starting wealth on purchased spells, his book of purchased spells will have the following cost and will probably contain the following spells of each level.
Code:
LVL NPC Starting Wealth Book Cost 9th 8th 7th 6th 5th 4th 3rd 2nd 1st
1st: 900 250 2
2nd: 2000 625 5
3rd: 2500 625 0 5
4th: 3300 925 1 5
5th: 4300 1225 2 5
6th: 5600 1675 1 2 5
7th: 7200 2125 2 2 5
8th: 9400 3025 1 2 3 5
9th: 12000 3925 2 2 4 5
10th: 16000 5125 1 2 3 4 5
11th: 21000 6775 1 2 2 3 4 5
12th: 27000 8725 2 2 3 4 4 5
13th: 35000 11125 1 2 3 4 4 4 5
14th: 45000 15000 3 3 4 4 4 4 6
15th: 59000 19650 2 3 4 4 5 5 5 6
16th: 77000 25650 3 4 5 6 6 6 6 6
17th: 100000 33300 4 4 5 5 6 6 6 6 6
18th: 130000 43125 6 6 6 6 7 7 7 8 9
19th: 170000 56450 8 8 8 8 9 9 9 10 10
20th: 220000 73050 10 11 11 11 11 11 11 12 12
NOTE #1: This assumes to a certain extent that the NPC is going for variety in their spells and not always on just the most powerful spells they can cast. This seems reasonable, because it would not make sense for a wizard to spend too much money on spells for which they do not have enough slots to memorize. In addition, it would be likely that lower level spells are easier to find, and therefore more likely to be written into the spellbook. Finally, I wanted the chart to show a cumulative effect, so even though a starting 5th level wizard could purchase 3rd level spells, the only way that would be possible is if the wizard did not buy as many spells at earlier levels, which would seem irrational. At later levels the starting GP grows faster and this is not an issue.
NOTE #2: The above chart does not include the spells that the wizard learns for free at each level. To include those as well, the TOTAL number of spells in the NPC wizard's book(s) is below:
Code:
Lvl 9th 8th 7th 6th 5th 4th 3rd 2nd 1st
1st: 5
2nd: 10
3rd: 2 10
4th: 5 10
5th: 2 6 10
6th: 5 6 10
7th: 2 6 6 10
8th: 5 6 7 10
9th: 2 6 6 8 10
10th: 5 6 7 8 10
11th: 3 6 6 7 8 10
12th: 6 6 7 8 8 10
13th: 3 6 7 8 8 8 10
14th: 7 7 8 8 8 8 11
15th: 4 7 8 8 9 9 9 11
16th: 7 8 9 10 10 10 10 11
17th: 6 8 9 9 10 10 10 10 11
18th: 10 10 10 10 11 11 11 12 14
19th: 12 12 12 12 13 13 13 14 15
20th: 14 15 15 15 15 15 15 16 17
NOTE #3: For each point of Intelligence bonus the wizard has, the spellbook also holds one additional 1st-level spell.
NOTE #4: They start out knowing all 10 cantrips, which takes up 10 pages in the book.
NOTE #5: A spell book is said to contain only 100 pages, so the wizard would need a second book at level 10, a third at level 14, a fourth at level 16, a fifth at level 17, a sixth at level 19, and a seventh spell book at level 20.
SUMMARY:
This is an interesting result, and not really what I would have expected. A mid- to high-level NPC has about 1/3 of the wealth of a PC, and can only spend 1/3 of their wealth on their spellbook, but even with that limitation, they can still have an extremely full and varied spellbook.