I tried calculating it but I did somthing wrong.

PWM Period = (PR2 + 1) * 4 * Oscilator * (TMR2 Prescale)

I'm assuming that PWM Period and Oscillator are in hertz, and since PR2 is the unknown in my case it should be:

40,000 = (PR2 + 1) * 4 * 20,000,000 * 1

And when I did it all out to solve for PR2 I got:

PR2 = -.995

I really dont think thats right.