edited sum_digits method