Part+one

To obtain a sound formula we will examine two methods of obtaining the triangular numbers: recursively and then by using an explicit formula. After examining these two methods, we will use the ideas and concepts behind them to come up with a more recursive formula that will not use an explicit equation. The first step that would have to be taken is to look at the patter for triangular numbers. Looking at this pattern, we can observe a couple of things: 1, 3, 6, 10, 15, 21, … Suppose you start an ‘n’ position where position 1 corresponds to the first triangular number, 1. The way you can obtain the following triangular number is by adding the current position and the previous number. For example, let us look at the following table to demonstrate this for the first 7 triangular numbers.
 * PART ONE**: Describe how to generate quickly the first 100 triangular numbers in column A. Assume or pretend that you __don’t__ know an explicit formula (i.e., a closed form expression in terms of n) for the nth triangular number and use a __recursive__ relationship (i.e., an expression that refers to one or more preceding values) on the spreadsheet.Triangular numbers are the number of discs that would fill a triangular pattern: 1,3,6,10,….
 * **Triangular Number** || 1  ||  3  ||  6  ||  10  ||  15  ||  21  ||  28  ||
 * **Position** || 1  ||  2  ||  3  ||  4  ||  5  ||  6  ||  7  ||
 * **Formula** || || 2+1  ||  3+3  ||  4+6  ||  5+10  ||  6+15  ||  7+28  ||

We can replicate this procedure in Microsoft Excel in the same way in a recursive manner using the column number of the cell and the previous number. To do this, we would start with the second place (or the number 3). In this cell (A2), we would do the following formula to compute the following triangular number: This formula will add the previous cell of the current cell (A1) with the current position of the cell (2) just like in the formula described above. Please note that we said we would start with the number 3. The reason is because, since there is no previous number in cell A1, Excel will throw an error. In order to avoid this, just place the 1 manually in A1. In the same manner, we can use the general formula n*(n+1)/2 for triangular numbers to calculate the formula in Microsoft Excel. In this case, n is the current position of the number once again. Again, we will use the function “ROW” to return the row number of the current position. The following formula can be entered in the first cell (A1) and then dragged down all the way down to row 100: Since we are trying to avoid any concrete formulas, we will just use the concept of this formula (and the first one) to come up with a more recursive formula. The last method to obtain the triangular numbers with a more recursive style can be obtained from the previous two examples. If we look carefully at the triangular sequence, we can see that the sum of two consecutive triangular numbers is a perfect square. The table below shows an example for the first 8 consecutive triangular numbers.
 * =A1+ROW**
 * =(ROW*((ROW+1)/2))**
 * **Triangular Number** || 1  ||  3  ||  6  ||  10  ||  15  ||  21  ||  28  ||  36  ||
 * **Position** || 1  ||  2  ||  3  ||  4  ||  5  ||  6  ||  7  ||  8  ||
 * **Sum** |||| 4  ||||  16  ||||  36  ||||  64  ||

For this formula, we will use the two previous consecutive triangular numbers of the current number and the number prior to the current number as well. So, the way the formula works is by obtaining the position ‘n’ of the number by taking the square root of the two previous consecutive numbers (since we already know that the sum of them two is a perfect square) and adding one to it (since the current position will be + 1). Now, we will just need to add the previous number to this ‘n’ position. At the end, we will end up with the following formula which will just need to be dragged to the 100th cell (A100). Let us notice that since we will need to use two previous consecutive numbers, this formula will not work for the first two numbers (1 and 3) without receiving an error from Excel. For this reason, we will just add the 1 in A1 and 3 in A2 and start with the formula in A3.
 * =SQRT(A2+A1)+1+A2**