In high school (and almost all the youtube videos), we are often taught that sound travels faster in solid than air because solids are generally denser; this allows the air particles to more readily collide with each other, thereby transmitting the energy more quickly.
The formula for speed of sound is clearly flying in the face of this explanation! The formula is given by $$ v=\sqrt{\frac{B}\rho} $$ where $B$ is the bulk modulus and $\rho$ is the density. From this formula, it is clear that speed of sound decreases as density increases.
I don't really need an explanation as to why this formula is correct; instead, I hope to know if there is any way to reconcile these two seemingly contradictory explanations. If not, can I get some sort of confirmation that any reasoning that appeals to density as a reason for higher speed of sound is flat out wrong?