Hi,
It depends how quickly you want the logic input to respond to the on/off state. The optimum might be with about 10% ripple on the capacitor, which requires a Time Constant of about 80 ms (i.e.10 cycles of the 120 Hz). With a 10k shunt resistor that would need 8 uF, or say 10 uF for convenience.
For a PICaxe to read the filtered signal as a digital '1', the level needs to be more than about 2.0 volts, so assume it averages at least 2.2 volts, with 200 mV peak-peak ripple. Then the average drain current through 10k would be about 220 uA, but the minimum current transfer ratio of the optocoupler is only 20%, so you should assume an average diode current of at least 1.1 mA. 24 V rms is probably sufficiently greater than the photodiode forward drops that you should be able to calculate using the rms value, so the 22 k appears to be (just about) "good enough", at least with a current transfer ratio nearer to the nominal (100% ?).
The logic input signal may "dither" (000010101111) for a few cycles when the ac is first applied; you will need to handle that in the software, or apply a Schmitt Trigger (positive feedback) action. Note that the hysteresis of the PIC{axe} "ST" inputs is not as large as might be assumed from the data sheet and that mode would require a higher input voltage, maybe 4V, and a higher LED current.
Cheers, Alan.