What is the reason behind the numbering of nitrogen bases?
ACDLabs maintains a nice summary of the IUPAC nomenclature rules with examples:

Heterocyclics (pyrimidine): http://www.acdlabs.com/iupac/nomenclature/79/r79_702.htm

Fused heterocycles (purine): http://www.acdlabs.com/iupac/nomenclature/79/r79_960.htm

Briefly, apply the following rules:


Number your rings so that the nitrogens end up with the lowest number combination. Thus pyrimidines have (1,3).
Number your rings so that other functional group have lowest possible numbers. Hence pyrimidine is numbered to the exocyclic carbonyl groups are (2,4).
In a fused system, numbering should prefer (in this order): ring with more nitrogens, rings with other heteroatoms, larger rings, nitrogen atom closer to ring junction.
Number toward the farther ring junction from where you started. Do not number junction positions.


Number 3 is fine and all, but purine seems to have a numbering scheme that does not match these rules, and it is supported by IUPAC. Likely, this represents a historical numbering pattern that predates the IUPAC rules. Everyone was using it and so it was adopted. You will likely just need to memorize it (or look it up when you need to).