Order by sum of digits

Write a function @sum_of_digits_sorted(f)@ that provided a list of non
negative integers f returns a list g with the very same numbers in f.
Numbers in g must appear in increasing sum of digits. For instance, if
56 and 2131 are numbers in f, number 2131 will appear before 56 in g
because the sum of digits of 2131 (sum is 7) is less the sum of digits
of 56 (sum is 11). Numbers of the same sum of digits must appear in the
usual increasing order.

Sample session

Problem information

Author: ProAl

Generation: 2026-01-25T15:23:49.269Z

© Jutge.org, 2006–2026.
https://jutge.org
