pfactor function