# Khan/khan-exercises

### Subversion checkout URL

You can clone with
or
.
Fetching contributors…

Cannot retrieve contributors at this time

77 lines (72 sloc) 4.6 KB
 Geometric sequences 2
randRangeNonZero(-8, 8) randFromArray([-1, 1]) * randRange(1, 4) randRange(1, 4) randRange(2, 5) randRange(-N - 1, 0) _.map(_.range(N), function(i) { if (i + OFFSET >= 0) { return reduce(A * pow(RN, i + OFFSET), pow(RD, i + OFFSET)); } else { return reduce(A * pow(RD, -i - OFFSET), pow(RN, -i - OFFSET)); } }) fractionReduce(RN, RD) _.map(TERMS, function(f) { return fractionReduce.apply(KhanUtil, f); })

The geometric sequence (a_i) is defined by the formula:

a_i = TERMS_TEX[0] \left(R_TEX\right)^{i - 1}

What is a_{N}, the ordinalThrough20(N) term in the sequence?

A * pow(RN / RD, N - 1 + OFFSET)

From the given formula, we can see that the first term of the sequence is TERMS_TEX[0] and the common ratio is R_TEX.

The second term is simply the first term times the common ratio.

Therefore, the second term is equal to a_2 = TERMS_TEX[0] \cdot R_TEX = TERMS_TEX[1].

To find a_{N}, we can simply substitute i = N into the given formula.

Therefore, the ordinalThrough20(N) term is equal to a_{N} = TERMS_TEX[0] \left(R_TEX\right)^{N - 1} = TERMS_TEX[N-1].

a_1 = TERMS_TEX[0]
a_i = R_TEXa_{i-1}

From the given formula, we can see that the first term of the sequence is TERMS_TEX[0] and the common ratio is R_TEX.

The second term is simply the first term times the common ratio.

Therefore, the second term is equal to a_2 = TERMS_TEX[0] \cdot R_TEX = TERMS_TEX[1].

To find the ordinalThrough20(N) term, we can rewrite the given recurrence as an explicit formula.

The general form for a geometric sequence is a_i = a_1 r^{i - 1}. In this case, we have a_i = TERMS_TEX[0] \left(R_TEX\right)^{i - 1}.

To find a_{N}, we can simply substitute i = N into the formula.

Therefore, the ordinalThrough20(N) term is equal to a_{N} = TERMS_TEX[0] \left(R_TEX\right)^{N - 1} = TERMS_TEX[N-1].