An implementation of the qth-Power algorithm