Counting the Number of Reps From a Rep Height I'm trying to calculate the number of reps from a rep height.
Example #1
Input: n = 2
Output: Result = 6
Because 1+2+2+1 = 6
--
Example #2
Input: n = 3
Output: Result = 12
Because 1+2+3+3+2+1 = 12
What formula could I use to get from input to output?

Let the 'output' be $S_n$. Then
$$S_n=1+2+...+n+n+(n-1)+...+1$$
$$=2(1+2+...+n)$$
(formula for triangular numbers)
$$=2\left(\frac{n(n+1)}{2}\right)$$
$$=n(n+1)$$
