Twin paradox calculation https://en.wikipedia.org/wiki/Twin_paradox
this is an article from wikipedia about the twin paradox.
an excerpt from "specific example"

How would I calculate the earth years from the traveller's perspective? The calculations are not stated in the article-- if I assume that moving clocks go slower, then from the traveller's perspective he has aged 6 years, shouldn't the earth years be $\frac{6}{\gamma}$ years, which would then be different from the 10 years as calculated in the "earth perspective" part? what am I missing?
 A: Your mistake is to ask about the "traveler's perspective". The traveler has one perspective on the outbound flight and a different perspective on the inbound flight. In both perspectives, earth clocks run slow. But the perspectives differ very much on how long ago the earth clocks were set to zero, and hence on what the earth clocks say now.
The outbound traveler, having arrived at his destination, says "right now, the earth clock reads 3.6 years and is running slow" --- which is why it advanced only 3.6 years during my 6 year journey."
Immediately after beginning his return journey, he says "right now, the earth clock reads 6.4 years and is running slow --- so that it will advance only another 3.6 years during my 6 year return journey, and will read 10 years when I get back".
A: You are overlooking the relativity of simultaneity.
On both legs of the journey, time on Earth is dilated (ie appears to be running more slowly) compared with the time in both the outward and return frames of the traveller. On that basis you might suppose the travelling twin would find the stay-at-home twin to be younger, and hence there to be a paradox. However, you have overlooked the fact that at the turn around point, the plane of constant time for the traveller switches from sloping upwards in time away from the Earth to sloping upwards in time towards the Earth. The effect is that the time 'now' on the Earth from the travellers perspective leaps forward at the turn around point, and it is that which causes the elapsed time on Earth to be greater.
A: You've overlooked the significant change in position displacement across the multi-year time displacement.
Let $\Delta t$ be time between events in the observer frame
Let  $\Delta t'$ be time between events in observed frame
Let $\Delta s$ be
change in displacement between frames across $\Delta t$ as measured by the observer
Let  $\Delta s'$ be change in displacement between frames across $\Delta t'$ as measured by the observed frame
Let $v$ be relative velocity between the frames
Then given constant relative velocity:
$\Delta t' = \gamma (\Delta t - v \Delta s/c^2)$
Or, if the observed frame values are known and we want to predict the observer frame,
$\Delta t = \gamma (\Delta t' + v \Delta s'/c^2)$
derivation
