Numerical simulations have been performed for the differentiation of planetesimals undergoing linear accretion growth with Al-26 and Fe-60 as the heat sources. Planetesimal accretion was started at chosen times up to 3 Ma after Ca-Al-rich inclusions (CAls) were formed, and was continued for periods of 0.001-1 Ma. The planetesimals were initially porous, unconsolidated bodies at 250 K, but became sintered at around 700 K, ending up as compact bodies whose final radii were 20, 50, 100, or 270 km. With further heating, the planetesimals underwent melting and igneous differentiation. Two approaches to core segregation were tried. In the first, labelled A, the core grew gradually before silicate began to melt, and in the second, labelled B, the core segregated once the silicate had become 40% molten. In A, when the silicate had become 20% molten, the basaltic melt fraction began migrating upward to the surface, carrying Al-26 with it. The Fe-60 partitioned between core and mantle. The results show that the rate and timing of core and crust formation depend mainly on the time after CAls when planetesimal accretion started. They imply significant melting where accretion was complete before 2 Ma, and a little melting in the deep interiors of planetesimals that accreted as late as 3 Ma. The latest melting would have occurred at <10 Ma. The effect on core and crust formation of the planetesimal's final size, the duration of accretion, and the choice of (Fe-60/Fe-56)(initial) were also found to be important, particularly where accretion was late. The results are consistent with the isotopic ages of differentiated meteorites, and they suggest that the accretion of chondritic parent bodies began more than 2 or 3 Ma after CAls.