Population and Ideas: A Theory of Endogenous Growth