My kid asked me this the other day, and it got me thinking that it is really impossible to calculate. We know the speed of sound (340.29 m/s) and speed of light (299,792,458 m/s) and I can calculate the offset of how far it travelled in 5 seconds... But since we don't know the origination point of the lighting and how long it took to get to me...can we really know the distance where the lighting occurred?
Am I missing something?
You don't need to know the origination point(you just need to know its a fixed point). Now let the distance between you and where lightning occurred be $d$ meters. Since, $$time=\frac{distance}{speed}$$ you can assume the the time lightning takes to reach you be equal to $t_1$ and the time that sound takes be $t_2$, and you are given $t_2-t_1=5$ seconds. Now you have,$$t_1=\frac{d}{299792458}$$ and $$t_2=\frac{d}{340.29}$$ Subtract the equations, $$5=\frac{d}{340.29}-\frac{d}{299792458}$$ You can now solve for $d$. It is not important to take into account the second fraction.(Light reaches almost instantaneously).This answer is from WolframAlpha $d=1701.45$ meters.