modiefied sum_to_n?