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

本文探讨了算术序列的概念,通过加或减共同差得到序列的下一项。递归公式在数学中用于定义序列,如a(n) = a(n-1) + 1,它依赖于前一项来生成序列。示例包括序列1, 2, 3, 4...的公式a(n) = n + 1。文章还提到了如何根据给定的第一项或没有第一项的情况找到序列的公式。" 133642066,8151430,修复手柄摇杆指南,"['游戏设备', 'DIY修复', '手柄维修', '游戏配件', '电子竞技']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

递归算法中的递归公式

什么是算术序列? (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

顺序:1、2、3、4…| 公式:a(n)= n + 13

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

顺序:8、13、18,…| 公式: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.

注意:数学家从1开始计数,因此按照惯例, n=1是第一项。 因此,我们必须定义第一个术语是什么。 然后我们必须找出并包括共同点。

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

顺序:1、2、3、4…| 公式:a(n)= n +1 | 递归公式: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

序列:3、8、13、18,... |公式:b(n)= 5n-2 | 递归公式: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]`
更多信息: (More Information:)

For more information on this topic, visit

有关此主题的更多信息,请访问

翻译自: https://www.freecodecamp.org/news/recursive-formulas-for-arithmetic-sequences/

递归算法中的递归公式

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值