I guess there would be some some small amount due to absorption in the atmosphere. But in theory there's not much complicated to it, and I don't see why it wouldn't still be the same. The formula works because light follows the inverse square law — and that works for studio lights in a small space just the same as it does for stars. (I mean, the miasmas of incandescent plasma, not celebrities.)
However, the caveat — and it's a huge one — is that in the real world at that distance, I don't think your flash output on the subject is going to be a significant factor compared to all the ambient light.
After all, the amount of light your GN 45m flash is providing at that distance is about the same as GN 0.14m flash would throw across a 3m room. For comparison, a typical camera's built-in pop-up flash has a GN of 14m or so — something like 10,000× that power. You can work out the math further if you like; I think that's enough for the intuitive point.
So, if you can find a situation where you have pitch black darkness yet 4 km of clear air, go ahead with this plan. Otherwise, don't even bother with the flash.