insectoid @ 2008-09-12, 11:24 am wrote:
A for loop is THE simplest way to do this (in Turing).
...
Anyway, with a for loop this can be done in 4 lines.
The simplest way to do it is using the formula, it's just a simple expression that can be done in 1 line. It may be a bit more complicated to figure out, though.
If you understand anything to do with summation though, using a for loop shouldn't be a problem at all. You go through each number up to 50 and create increase a sum variable by that value over each iteration.