Speed of Sound in matter

So basically when it comes to the speed of sound, it is said that speed of sound in media is based on two main factors - 1)elasticity and 2)density from the formula

V= $\sqrt{E/\rho }$ where E is the modulus of elasticity and $\rho$ is the density.Now this represents that Speed of Sound is inverse to the density. Then how come is the speed of sound more in solids than in gases (which is a denser medium). I think it is because the elasticity might override the density part, but I am not able to understand the inverse relation cause it seems that closer the atoms are to each other (ie denser) there must be quicker flow of energy from one point to other. I agree that this might hinder the intensity, but how come does it affect the speed of sound?

Adiabatic bulk modulus of air $=1.4\times 10^5$ Pa and Young's modulus of steel $=1.8 \times 10^{11}$ Pa.
Density of air $= 1.2$ kg m$^{-3}$ and of steel $8050$ kg m$^{-3}$.

The interaction between the atoms within steel is via the bonds whereas the interaction in air are by molecules colliding with one another and limited by the speed at which the molecules move. So the speed of sound in steel is greater than that of air even though it is much denser.

What you have is two parameters one which is related to the restoring force (elasticity) and the other related to the mass of the material (density).

The molecules are vibrating and a greater restoring force means that they return back to their mean position quicker (potentially increasing the speed of sound) but if the mass is larger then this means that their return back to their mean position will be slower (potentially decreasing the speed of sound).

You know that sound is a longitudinal wave. It passes through a medium by pressurizing and depressurizing the medium. Solids are highly elastic than air. They are very hard to deform. So, they resist any change in the positions of the atom. Once disturbed, the medium develops a high restoring force to tend back to it's original position, but inertia causes the particle to overshoot the equilibrium position and hence the particle moves to and fro about the equilibrium position. This is the reason for vibration.

Due to high interaction of the particles in a solid, any disturbance to one atom is transferred very fast to the neighboring particle. So the disturbance is transferred very far in a very little interval of time.

In the case of air, the particles are feebly interacted. So, the message is not transferred that fast and it takes some time to get the information transferred from one point to another. Don't think that the frequency is affected. Frequency is medium independent. It depends on the number of cycles of compression emitted by the source, like how many times you push and pull the particles in the medium.

The fact is that when you compare the speed of sound in different media, you must take into account both the elasticity and density of the medium. That's what Newton-Laplace equation suggests. For example, the speed of sound through air can be solely explained on the basis of density.