working on sort_nth_digit