Artificial intelligent assistant

Brick wall uses 2 less bricks per level. How many bricks will there be? There is a brick wall that forms a rough triangle shape and at each level, the amount of bricks used is two bricks less than the previous layer. Is there a formula we can use to calculate the amount of bricks used in the wall, given the amount of bricks at the bottom and top levels?

$S = (a_1 + a_n)/2*(a_n-a_1 + 2)/2$

Sum of the elements of an arithmetic progression is $S = (a_1+a_n)*n/2$. In case you do not now what $n$ is equal to, you can use the following formula:
$S = (a_1 + a_n)/2*(a_n-a_1 + x)/x$, where $a_1$ is the first element, $a_n$ is the last element, $x$ is the "step", the number by which you increment each element of the progression in order to get its next element.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 6635dcf48d729c0bb8355621cfc31f0d