I have a code where I want to avoid using a for/each loop to count the amount of points options in poll have together. Reason is, every option has different ammount of points and I want to get number of votes by counting options and points they have together and then dividing total points (votes) by those points...I have a list of options where every option has a different amount of points. I think this is easier to understand:Option 1 = 7 pointsOption 2 = 6 pointsOption 3 = 5 pointsOption 4 = 4 pointsOption 5 = 3 pointsOption 6 = 2 pointsOption 7 = 1 pointIs there some easy math way of getting to number of points (in this case 28) without using:$options = array(lala, lalala, flflf, qddwq, adslalsd, wqdqowdq, acaca);$points = 0; $i = 1;foreach($options as $option){    $points = $points + $i;    $i++;}echo $points;Or$points = 0;$options_num = 7;for ($i=1; $i <= $options_num; $i++){      $points = $points + $i;}echo $points;I just want to make as small load on the server as possible, mainly when users won't be limited with amount of options they can insert and I am sure there has to be some simple math I can use, but I'm just not getting it.
Count amount of points for XY options (in poll) where options dont have equal amount of points
php;math
The sum7 + 6 + 5 + 4 + 3 + 2 + 1 = 28Corresponds to a Triangular Number of the form(n * (n + 1)) / 2i.e. (7 * (7 + 1) / 2 = 28.