Why is there a discrepancy between $m_n-m_p$ and $m_d-m_u$? The difference in mass between a neutron and a proton is $1.3\space  {\rm MeV}/c^2$, but the mass difference between an up quark and a down quark is $2.5\space{\rm MeV}/c^2$. How come the mass differences aren't the same?
 A: Some comments mention that calculating the mass of a nucleon is extremely complicated, which is true: see lattice QCD. It does require a supercomputer. But the strong force is insensitive to quark flavor, so I'm not sure that any of that complexity is related to this question.
The quark flavors differ not only in mass but also in electric charge, and a naive back-of-the-envelope calculation suggests that the rest of the mass difference could be electromagnetic. The energy needed to bring three charges $q_1,q_2,q_3$ from infinity to a triangle of side $r$ is $k(q_1q_2{+}q_2q_3{+}q_3q_1)/r$. For two down quarks and one up quark, that's $-\frac13 ke^2/r$, and for two up quarks and one down quark, it's zero. That would account for the discrepancy if $\frac13 k e^2/r \approx 1.2\text{ MeV}$, or $r\approx 0.4\text{ fm}$, which is close to the size of a nucleon.
The paper "Electromagnetic proton-neutron mass difference" by Oleksandr Tomalak (DOI, arXiv) quotes the results of much more sophisticated calculations of the electromagnetic contribution, which hover around 1 MeV with large error margins.
