math/, pub/: Take a more consistent approach to prime-generation failures.