Loops were reversed and off-by-one error one carryover check.
Solution to problem 13.