Factoring Hecke polynomials modulo a prime