PE problem23 w/ prime factorization and fancy formula