So I understand the basic concept of when $n=3k $
$(3k)^2 + 1 = 9k^2 + 1 = 3(3k^2) + 1 $
But I saw a solution when we use $3k+ 1$.
for example for $(3k+1)^2 + 1 = 9k^2 + 6k + 1 + 1 = 3(3k^2 + 2k) + 2.$
where does the 6 come from?
Same goes for $3k +2.$
and $(3k+2)^2 + 1 = 9k^2 + 12k + 4 + 1 = 3(3k^2 + 4k) + 3 + 2 = 3(3k^2 + 4k + 1) + 2. $
where does the 12 come from? How does the +4 and +1 change to +3 and +2? And then how do we get the + 1 back in the brackets at the end?
Thanks to anyone that can help!