|
|
|
|
|
by iroddis
1081 days ago
|
|
I don’t think that’s much clearer at all. I realize that you’re citing a specific example, but if your approach is to understand the problem first, then you may as well use the closed-form solution of your problem: sum(1,n) = n*(n+1)/2 Which some compilers will produce for you, even if you use loops. Maybe if you chose a different example, like generating power sets or the Fibonacci sequence, your point would be better made? |
|