fast way to generate the P(k)-grid