# 递归算法中的递归公式_算术序列的递归公式

2021年6月30日 25点热度 0条评论 来源: cumian9828

### 什么是算术序列？(What is an Arithmetic Sequence?)

A sequence is list of numbers where the same operation(s) is done to one number in order to get the next. Arithmetic sequences specifically refer to sequences constructed by adding or subtracting a value – called the common difference to get the next term.

In order to efficiently talk about a sequence, we use a formula that builds the sequence when a list of indices are put in. Typically, these formulas are given one-letter names, followed by a parameter in parentheses, and the expression that builds the sequence on the right hand side.

`a(n) = n + 1`

`a(n) = n + 1`

Above is an example of a formula for an arithmetic sequence.

### 例子(Examples)

Sequence: 1, 2, 3, 4, … | Formula: a(n) = n + 13

Sequence: 8, 13, 18, … | Formula: b(n) = 5n - 2

### 递归公式(A Recursive Formula)

Note: Mathematicians start counting at 1, so by convention, `n=1` is the first term. So we must define what the first term is. Then we have to figure out and include the common difference.

Taking a look at the examples again,

Sequence: 1, 2, 3, 4, … | Formula: a(n) = n + 1 | Recursive formula: a(n) = a(n-1) + 1, a(1) = 1

Sequence: 3, 8, 13, 18, … |Formula: b(n) = 5n - 2 | Recursive formula: b(n) = b(n-1) + 5, b(1) = 3

### 查找公式(给以第一项的序列)(Finding the Formula (given a sequence with the first term))

``````1. Figure out the common difference
Pick a term in the sequence and subtract the term that comes before it.
2. Construct the formula
The formula has the form: `a(n) = a(n-1) + [common difference], a(1) = [first term]```````

### 查找公式(给出没有第一项的序列)(Finding the Formula (given a sequence without the first term))

``````1. Figure out the common difference
Pick a term in the sequence and subtract the term that comes before it.
2. Find the first term
i. Pick a term in the sequence, call it `k` and call its index `h`
ii. first term = k - (h-1)*(common difference)
3. Construct the formula
The formula has the form: `a(n) = a(n-1) + [common difference], a(1) = [first term]```````