Speedup exp_mangoldt for large numbers -- primality + power detection instead of factoring