I've been experimenting along these lines & I've been using i & if statements.
For your scope, you have 3 points, so n=3. The i "points" are located at 0, .5 and 1
With this in mind, using a if statement short cut, you can skip the equal or above conditions & just use values of i.
I'm having trouble explaining it, but in the end you'll come up with:
I've done larger statements like these where n=9;