Solution to sum_time_n_times