  In this paper we show that both of the Green-Schwarz anomaly factorization
formula for the gauge group $E_8\times E_8$ and the Ho\v{r}ava-Witten anomaly
factorization formula for the gauge group $E_8$ can be derived through modular
forms of weight 14. This answers a question of J. H. Schwarz. We also establish
generalizations of these factorization formulas and obtain a new
Ho\v{r}ava-Witten type factorization formula.
