Which formula to use in order to choose the right power rating for a resistor used in a half-wave rectifier?
A 40 Vp-p sine wave across a 0.25 ohm load is a power of 800 watts. A perfect diode will block half this power so the power in the load is 400 watts.

Reason: 40 Vp-p is 14.14 V RMS so power in the resistor is this voltage squared divided by 0.25 ohms = 200/0.25 = 800 watts.