I don't know of any formula, but let's do some ballpark math.
36V 4Ah battery has nominally 144Wh (36V * 4Ah).
Now, 42W at 5V 2.4A doesn't make any sense (5V and 2.4Ah makes less sense for a solar panel).
So I'd guess it was actually 5V * 2.4A = 12W.
144Wh / 12W = 12h of charging considering 100% efficiency, etc.
If you consider 80% efficiency for the charger*, then 12h/0.8 = 15h of full output from the solar panel.
So maybe two days for 12W solar panel?
And probably 1/3 or 1/4 that for a 42W solar panel.
*Peter correctly pointed out that you can't charge a 36V battery with a 5V supply. Even if you had a 36V supply you shouldn't directly connect the battery either. I'm optimistically accounting 80% efficiency with whatever devices you put between the 5V supply and the 36V battery (possibly a step up converter and a charger? idk :P).