It's clever... I think you are essenrially using
(n+1)² = n² + 2n + 1
where a = n² and b = 2n + 1 ... you are starting at those values for n = 1 and then use it to compute the n = 2 squarw and then since b = 2n + const you have to increase it by 2 in each step