Long addition

From CS2800 wiki

It turns out that these algorithms also work in base b; one just needs to represent digits in base [math]b [/math]. For example, to add [math](124)_7 [/math] and [math](66)_7 [/math], we can add them digit by digit, starting from the right, and handling carries appropriately. We would add 6 and 4 to get the number 10, which is represented by [math](13)_7 [/math]; we would keep the 3 and carry the 1. We would then add the carry and the second digits to get [math]2 + 6 + 1 = 9 = (12)_7 [/math]; again we keep the 2 and carry the 1. Finally we add the third digit and the carry to get the third digit 2; this gives us [math](124)_7 + (66)_7 = (223)_7 [/math].

1 2 4
+ 6 6     (base 7)
2 2 3

You could prove that these algorithms all work using induction.