Alex wants to build a tower of height \(N\) levels. He wants to build the tower as follows: the \(i^{th}\) level of the tower must have \(1 + 2 + ... + (i - 1) + i\) blocks, i.e., the top level of the tower must consist of \(1\) block, the second level must consist of \(1 + 2 = 3\) blocks, the third level must have \(1 + 2 + 3 = 6\) blocks, and so on. The numbering of levels is done from top to bottom.
Find the total number of blocks required to build a tower of height \(N\).
Input Format:
- The first line contains an integer \(T\), which denotes the number of test cases.
- The first line of each test case contains one integer \(N\), denoting the height of the tower.
Output Format:
For each test case, print the total number of blocks required to build a tower of height \(N\).
Constraints:
\(1 <= T <= 10^3\)
\(1 <= N <= 10^5\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial