Make is_bpsw_prime a first class function (though currently not exported)
is_perfect_square doesn't use isqrt
mapes -> tablephi.  Caching legendre phi