No, the non-integral atomic masses of elements are not primarily due to the difference in masses between protons and neutrons. The atomic masses of elements are determined by the average mass of their isotopes, taking into account the abundance of each isotope.
Isotopes are variants of an element that have the same number of protons but differ in the number of neutrons. Since isotopes have different numbers of neutrons, their masses will vary slightly.
The atomic mass of an element is the weighted average of the masses of its isotopes, where the weighting is based on the abundance (frequency) of each isotope in nature. Therefore, atomic masses can be non-integral because they consider the contributions of different isotopes with different masses and abundances.
While the difference in masses between protons and neutrons does play a role in the atomic masses of elements, it is not the sole reason for non-integral atomic masses. The presence of different isotopes and their respective abundances are the primary factors leading to non-integral atomic masses.