Partial Products Algorithm Math