changed formulation for computing pi p()