  The composition of Jupiter and the primordial distribution of the heavy
elements are determined by its formation history. As a result, in order to
constrain the primordial internal structure of Jupiter the growth of the core
and the deposition and settling of accreted planetesimals must be followed in
detail. In this paper we determine the distribution of the heavy elements in
proto-Jupiter and determine the mass and composition of the core. We find that
while the outer envelope of proto-Jupiter is typically convective and has an
homogeneous composition, the innermost regions have compositional gradients. In
addition, the existence of heavy elements in the envelope leads to much higher
internal temperatures (several times 10$^4$ K) than in the case of a
hydrogen-helium envelope. The derived core mass depends on the actual
definition of the core: if the core is defined as the region in which the
heavy-element mass fraction is above some limit (say 0.5), then it can be much
more massive ($\sim$ 15 M$_{\oplus}$) and more extended (10\% of the planet's
radius) than in the case where the core is just the region with 100\% heavy
elements. In the former case Jupiter's core also consists of hydrogen and
helium. Our results should be taken into account when constructing internal
structure models of Jupiter and when interpreting the upcoming data from the
{\it Juno} (NASA) mission.
