Xét \(n^2+1=n^2+mn+np+pm=n\left(m+n\right)+p\left(m+n\right)=\left(m+n\right)\left(n+p\right)\)
Tương tự: \(m^2+1=\left(m+n\right)\left(m+p\right)\)
\(p^2+1=\left(p+m\right)\left(p+n\right)\)
\(\Rightarrow\dfrac{\left(n^2+1\right)\left(p^2+1\right)}{m^2+1}=\dfrac{\left(n+p\right)^2\left(m+n\right)\left(m+p\right)}{\left(m+n\right)\left(m+p\right)}\)
\(=\left(n+p\right)^2\)
\(\Rightarrow\sqrt{\dfrac{\left(n^2+1\right)\left(p^2+1\right)}{m^2+1}}=n+p\)
Tương tự: \(\sqrt{\dfrac{\left(p^2+1\right)\left(m^2+1\right)}{n^2+1}}=m+p\)
\(\sqrt{\dfrac{\left(m^2+1\right)\left(n^2+1\right)}{p^2+1}}=m+n\)
\(\Rightarrow B=m\left(n+p\right)+n\left(m+p\right)+p\left(m+n\right)\)
\(=2\left(mn+np+pm\right)=2\)
Vậy B=2