Generalized continued fraction expansions for π and e