The effect of life expectancy on education and population dynamics